Dear All,
I have to problems regarding radiobuttonlists.
1) How can i position a radiobuttonlist on screen dynamically?
2) How can i get the selectedIndexChanged of the dynamically generated radiobuttonlist?
Here is my present code to generate the radiobuttonlists:-
private void Add_More_Rooms()
{
int iRoomNo = Convert.ToInt32(ViewState["AddRooms"]);
iRoomNo ++;
ViewState["AddRooms"] = iRoomNo;
StringBuilder sb = new StringBuilder();
sb.Append("
");
sb.Append(" ");
phMoreRooms.ID = "phMoreRooms" + iRoomNo;
phMoreRooms.Controls.Add(new LiteralControl(sb.ToString()));
//create dynmic radiobuttonlist
RadioButtonList rdoMoreRooms = new RadioButtonList();
//get the first word before the space
rdoMoreRooms.ID = "rdoMoreRooms" + iRoomNo;
rdoMoreRooms.CssClass = "label";
rdoMoreRooms.AutoPostBack = true;
//rdoMoreRooms.SelectedIndexChanged += new System.EventHandler(this.radioButton_Check_Changed);
rdoMoreRooms.RepeatDirection = RepeatDirection.Horizontal;
rdoMoreRooms.Items.Add(new ListItem("Double", "Double"));
rdoMoreRooms.Items.Add(new ListItem("Twin", "Twin"));
rdoMoreRooms.Items.Add(new ListItem("Single", "Single"));
rdoMoreRooms.Items.Add(new ListItem("Triple", "Triple"));
phMoreRooms.Controls.Add(rdoMoreRooms);
phMoreRooms.Controls.Add(new LiteralControl("
"));
}
Thanks for all your help and time
Johann