473,597 Members | 2,413 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

RadioButtonList in DataList EditItemTemplat e

Hi,

When I try to reference the radiobuttonlist control in edititemtemplat e 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_I temDataBound(ob ject sender, DataListItemEve ntArgs
e)

{

if (DataListItems. EditItemIndex != -1 && e.Item.ItemInde x != -1 &&
e.Item.HasContr ols())

{

Label rbllblIsAdded = (Label)e.Item.F indControl("lbl IsAdded");

RadioButtonList rbl =
(RadioButtonLis t)e.Item.FindCo ntrol("edtrblIs Added");

if (rbllblIsAdded. Text == "Added")

{

rbl.SelectedVal ue = "Yes";

}

else

{

rbl.SelectedVal ue = "No";

}

}

}

<EditItemTempla te>

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

<tr>

<td width="10%">

<asp:RadioButto nList ID="edtrblIsAdd ed" RepeatDirection ="Horizontal "
runat="server">

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

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

</asp:RadioButton List>

<asp:RequiredFi eldValidator ID="RFVedtrblIs Added" runat="server"
ErrorMessage="P lease select added/removed"

ControlToValida te="edtrblIsAdd ed" ValidationGroup ="UpdateValidat ionControls"
ToolTip="Please select added/removed">*</asp:RequiredFie ldValidator>
</td>

........

Thanks,

Sudheer.
Sep 20 '06 #1
0 2038

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4548
by: etantonio | last post by:
Good Morning, I still havent solved my problem with a textbox inside an editItemTemplate of a datalist, in fact now it is filled with the word "CIAOOOOOO" , if a runtime in the form I put a different word like "PIZZAAAA" this new word is not available in the Update_Command following :
0
3094
by: Alex | last post by:
Interested in more .NET stuff visit www.dedicatedsolutions.co.uk The DataList is not as powerful as the DataGrid. It requires more work from you since it has no default data presentation format. However, the DataGrid begins to get very cumbersome as the number of columns of data you present increases. Anything more than half a dozen columns or so and you probably induce horizontal scrolling - a real no-no for me. If you put such a...
8
7430
by: Adam Billmeier | last post by:
Problem: I am trying to use FindControl to grab a dropdownlist that is in the EditItemTemplate of a Datalist and then Bind it to a dataset. I also then need to put the correct values in all of the text boxes in the EditItemTemplate. I have set the EditItemIndex for the Datalist to -1, and then bound the Datalist. I then want to Bind the DropDown, and populate the values. All attempts to use FindControl on the control return "Nothing"
4
2104
by: tshad | last post by:
I have a DataList that I have set up to allow editing. The edit button does go to the subroutine defined by OnEditCommand. The problem is that it doesn't change the fields to editing fields. The textbox doesn't show from the edititemtemplate section. I don't get any errors. Do I need to do something special to tell it to do this? Here is the datalist: ...
0
1170
by: ad | last post by:
I have a tabe with a filed SexID, it use 1 for Male and 2 for Female. I want to let user can edit this in a DataGrid with a RadioButtonList. I add a RadioButtonList in the EditItemTemplate: ---------------------------------------------------------------------------- ---------------- <EditItemTemplate> <asp:RadioButtonList ID="RadioButtonList1" Runat="server"> <asp:ListItem Value="1">Male</asp:ListItem> <asp:ListItem...
2
3431
by: Hans Merkl | last post by:
Hi, I am trying to use a user control as EditItemTemplate in a DataList. It loads fine but I can't figure out how to bind to the data of the DataList. Here is what I have got so far: //Page_load of my user control protected void Page_Load(object sender, EventArgs e) { IDataItemContainer DataContainer = this.Parent as
3
10288
by: Mirek Endys | last post by:
I have DataList as part of DataList item. DataList in DataList. The parent DataList working well including Edit command, that shows Edit template and correctly bind the data into edit template (where is the child DataList).... But in case I want to make Edit in this child DataList it is not working... No edit template showed... :( this is a code that i use for the child DataList... Edit command // this is for child DataList...
1
1978
by: Ben | last post by:
Hi, The gridview contains a radiobuttonlist with boolean values (true/false) coming from a database. In normal mode, the gridview displays True or False for that field. What i want is to change True' and 'False' by 'Yes' and 'No' in normal mode. I tried this, but still get True / False. Thanks for help
1
10754
by: renuami | last post by:
Hello friends please advise....... I am building an application for Survey. For this i have GridView with two Template fields. The first Template has Label (To display question text) and RadioButtonList (for options). The 2nd Template field is the primary key value. And i have a button on the form. In the button click event i wrote code to grab RadioButtonList values.But the selected value is coming as null....PLEASE ADVISE.... Let me...
0
7959
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7883
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8263
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8254
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6677
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5842
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2393
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1492
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1226
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.