I am so sorry again for asking too many questions. I have been stuck since yesterday on these issues.
I have a couple of questions. Please tell me if I can ask two questions in one thread. If I can't then I can modify the question.
Different forums have different rules.
Thank you very much.
First issue, I have two textbox controls.
One is called txtboatregNum is inside a Gridview:
For simplicity, I will show just that control inside a gridview:
<asp:MultiView ID="myMultiView" ActiveViewIndex="0" runat="server">
<asp:View ID="view1" runat="server">
<asp:GridView ID="Gridview1" Style="table-layout: fixed;" runat="server" ShowFooter="true"
AutoGenerateColumns="false" onrowdatabound="Gridview1_RowDataBound" OnRowDeleting="Gridview1_RowDeleting">
<Columns>
<asp:BoundField DataField="RowNumber" Visible="false" HeaderText="Row Number" />
<asp:TemplateField HeaderText="Aircraft Registration #:">
<HeaderStyle HorizontalAlign="Left" />
<ItemTemplate>
<asp:TextBox ID="txtboatregNum" runat="server" Style="width: 593px;" class="form-control" ></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<HeaderStyle Width="70" />
<ItemStyle Width="70" />
<ItemTemplate>
<asp:Button ID="BtnAdd" runat="server" Text="Add" OnClick="BtnAdd_Click" CssClass="grvDelButton" />
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField ShowDeleteButton="True">
<ControlStyle CssClass="grvDelButton" />
</asp:CommandField>
</Columns>
</asp:GridView>
</asp:view>
The other control is called txtARegNo and is inside a Repeater control:
<asp:Repeater ID="Repeater2" runat="server" OnItemDataBound="repeater_ItemDataBound">
<ItemTemplate>
<table style="width:100%;border: 1px solid black;">
<tr>
<td style="width:50%;border-collapse: collapse;border: 1px solid black;">
<asp:TextBox ID="txtARegNo" style="width:270px;margin-left:195px;" runat="server"></asp:TextBox>
</td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
</asp:View>
</asp:MultiView>
When a user enters a value say 1234B into the txtboatRegNo in Gridview, how does that value automatically populate the txtARegNo that is inside a Repeater?
I tried the following script but it does nothing:
<script src="https://code.jquery.com/jquery-3.0.0.js"></script>
<script type="text/javascript">
$(function () {
$('[id*=txtboatRegNo]').change(function () {
$('[id*=txtARegNo]').val(this.value);
});
});
</script>
The other issue that I have been trying to resolve since yesterday is to be able to validate RadioButtonList inside a Repeater
The following RadioButtonList control has a Yes or No options. If user tries to continue to other page or try to submit without checking either Yes or No, we would like to raise an error that says, "Please choose either Yes or No.
<asp:Repeater ID="Repeater2" runat="server" OnItemDataBound="repeater_ItemDataBound">
<ItemTemplate>
<table style="width:100%;border: 1px solid black;">
<tr>
<td style="width:50%;border-collapse: collapse;border: 1px solid black;">
Purchased:<asp:radiobuttonlist ID="rblPurchaseType" runat="server" RepeatDirection="Horizontal" TextAlign="Right" style="display:inline;">
<asp:ListItem Text="New" />
<asp:ListItem Text="Used" />
</asp:RadioButtonList>
</td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
Can you please help?