Velocity Reviews

Velocity Reviews (
-   ASP .Net (
-   -   RadioButtonList in DataList EditItemTemplate (

Sudheer Aalla 09-20-2006 05:13 PM

RadioButtonList in DataList EditItemTemplate

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


if (DataListItems.EditItemIndex != -1 && e.Item.ItemIndex != -1 &&


Label rbllblIsAdded = (Label)e.Item.FindControl("lblIsAdded");

RadioButtonList rbl =
(RadioButtonList)e.Item.FindControl("edtrblIsAdded ");

if (rbllblIsAdded.Text == "Added")


rbl.SelectedValue = "Yes";




rbl.SelectedValue = "No";





<table width="100%" cellspacing="0" cellpadding="0" style="height:100%;">


<td width="10%">

<asp:RadioButtonList ID="edtrblIsAdded" RepeatDirection="Horizontal"

<asp:ListItem Value="Yes">A</asp:ListItem>

<asp:ListItem Value="No">R</asp:ListItem>


<asp:RequiredFieldValidator ID="RFVedtrblIsAdded" runat="server"
ErrorMessage="Please select added/removed"

ControlToValidate="edtrblIsAdded" ValidationGroup="UpdateValidationControls"
ToolTip="Please select added/removed">*</asp:RequiredFieldValidator>





All times are GMT. The time now is 01:57 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.