I need to dynamically Add Radio button at the right side of each node and if user clicks on that I need to do some changes in database.
Currently I am framing a Table with Radiobutton and Adding that to the Node Text of Treeview Node. All fine but Eventhandler is not working.
Can someone please help me out.
HtmlTable oItemTable = new HtmlTable();
oItemTable.Width = "100%";
HtmlTableRow oItemRow = new HtmlTableRow();
HtmlTableCell oItemDescCell = new HtmlTableCell();
oItemDescCell.Width = "200px";
oItemDescCell.InnerText = sItemID;
oItemRow.Cells.Add(oItemDescCell);
HtmlTableCell oItemMonitorCell = new HtmlTableCell();
oItemMonitorCell.Width = "10px";
RadioButton rdbItemMonitor = new RadioButton();
rdbItemMonitor.ID = sItemID + "M";
rdbItemMonitor.GroupName = sItemID;
rdbItemMonitor.AutoPostBack = true;
rdbItemMonitor.CheckedChanged += new EventHandler(rdbItemMonitor_OnCheckedChanged);
oItemMonitorCell.Controls.Add(rdbItemMonitor);
oItemRow.Cells.Add(oItemMonitorCell);
StringBuilder sbItemTable = new StringBuilder();
using (StringWriter swItemTable = new StringWriter(sbItemTable))
{
using (HtmlTextWriter twSegmentTable = new HtmlTextWriter(swItemTable))
{
oItemTable.RenderControl(twSegmentTable);
}
}
oNodeItem.Text = sbItemTable.ToString();
trvMyPlans.Nodes.Add(oNodeItem);