Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Radiobutton event handling in an Usercontrol

Status
Not open for further replies.

tondarb

Programmer
Oct 8, 2003
37
US
Hi,
I am new to C#. I am just learning. I am struck with a problem. I have created a usercontrol with dynamic table with radiobuttons. Now I don't know how to
handle the event radioButton_SelectedIndexChanged.

This is a part of my code. Please help me.


Table InnerTable=new Table();
InnerTable.BorderWidth=0;
cellForInnerTable.Controls.Add(InnerTable);
if(strMainOuter.Length>1)
{
string strSubInner=strMainOuter[1];
string[] strSubHeading=strSubInner.Split(new char[] {'#'});
foreach(string strsubOption in strSubHeading)
{
TableRow tableRowsubOption=new TableRow();
TableCell RadioCell=new TableCell();
RadioButton radioButton=new RadioButton();
radioButton=new RadioButton();
radioButton.GroupName="Group" + strMainChk;
radioButton.ID="rdo" + strsubOption;
radioButton.Text=strsubOption;
radioButton.AutoPostBack=true;
RadioCell.Controls.Add(radioButton);
tableRowsubOption.Cells.Add(RadioCell);
InnerTable.Rows.Add(tableRowsubOption);
}
}


Please help me
thanks in advance
tondarb


 
sorry its event radioButton_CheckedChanged
 
You need to add an event handler for the radiobutton:
I am not sure on the C# syntax:
Code:
radiobutton.CheckChanged += new EventHandler(radiobutton_CheckChanged);


Then you need to write code for the Event Handler..

Hope this gets you started....

Jim
 
Thank you very much Jim Now I am able to handle it
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top