Home
Forums
New posts
Search forums
Articles
Latest reviews
Search resources
Members
Current visitors
Newsgroups
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Home
Forums
Newsgroups
Microsoft DotNet
Microsoft ASP .NET
RadioButtonList in DataList EditItemTemplate
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Sudheer Aalla, post: 9514214"] Hi, When I try to reference the radiobuttonlist control in edititemtemplate in ItemDataBound event of datalist control I am getting NULL reference. I am trying to pre select the yes/no button depending on the label text in item template. But I am able to get the value of lable control which is in itemtemplate. Is there anything else I am missing here??? public void DataListItems_ItemDataBound(object sender, DataListItemEventArgs e) { if (DataListItems.EditItemIndex != -1 && e.Item.ItemIndex != -1 && e.Item.HasControls()) { Label rbllblIsAdded = (Label)e.Item.FindControl("lblIsAdded"); RadioButtonList rbl = (RadioButtonList)e.Item.FindControl("edtrblIsAdded"); if (rbllblIsAdded.Text == "Added") { rbl.SelectedValue = "Yes"; } else { rbl.SelectedValue = "No"; } } } <EditItemTemplate> <table width="100%" cellspacing="0" cellpadding="0" style="height:100%;"> <tr> <td width="10%"> <asp:RadioButtonList ID="edtrblIsAdded" RepeatDirection="Horizontal" runat="server"> <asp:ListItem Value="Yes">A</asp:ListItem> <asp:ListItem Value="No">R</asp:ListItem> </asp:RadioButtonList> <asp:RequiredFieldValidator ID="RFVedtrblIsAdded" runat="server" ErrorMessage="Please select added/removed" ControlToValidate="edtrblIsAdded" ValidationGroup="UpdateValidationControls" ToolTip="Please select added/removed">*</asp:RequiredFieldValidator> </td> ........ Thanks, Sudheer. [/QUOTE]
Verification
Post reply
Home
Forums
Newsgroups
Microsoft DotNet
Microsoft ASP .NET
RadioButtonList in DataList EditItemTemplate
Top