Monday, 15 March 2010

asp.net - Get the id of parent listview in child listview checkbox change event -


chkSubModuleView_CheckedChanged () to get the iwant ID of chkModule on the event. Please tell me how to get the reference to the ID or parent checkbox, click on the Child checkbox in the server side. How to differentiate between different modules

  Enter the code here & lt; Asp: ListView id = "lvModule" runat = "server" & gt; & Lt; LayoutTemplate & gt; & Lt; Width of table = "600px" range = "0" cellpadding = "0" cell area = "0" class = "list view table" & gt; & Lt; TR & gt; & Lt; Th style = "width: 10%;" & Gt; Module & lt; / Th & gt; & Lt; / TR & gt; & Lt; Asp: place holder id = "item placeholder" run = "server" & gt; & Lt; / ASP: Placeholder & gt; & Lt; / Table & gt; & Lt; / LayoutTemplate & gt; & Lt; ItemTemplate & gt; & Lt; TR & gt; & Lt; TD & gt; & Lt; Asp: checkbox id = "chkModule" runat = "server" reasons for validity = "wrong" autopostback = "correct" on checked change = "chkModule_CheckedChanged" & gt; & Lt; / Asp: checkboxes & gt; & Lt; Asp: HiddenField id = "hfEntityName" value = '& lt;% # Eval ("EntityName")% & gt; Runat = "server" /> & Lt;% # Eval ("Title")%> & Lt; Asp: HiddenField id = "hfID" value = '& lt;% # Eval ("ID")% & gt; Runat = "server" /> & Lt; ASP: label ID = "label" run = "server" & gt; & Lt; / ASP: Labels & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; Td colspan = "2" style = "padding-left: 20px;" & Gt; & Lt; Asp: ListView id = "lvSubModule" runat = "server" & gt; & Lt; LayoutTemplate & gt; & Lt; Width of table = "100%" cellspacing = "0" limit = "0" class = "list view table layer 2" & gt; & Lt; TR & gt; & Lt; Th style = "width: 20%;" & Gt; Sub module & lt; / Th & gt; & Lt; Th style = "width: 20%;" & Gt; & Lt; ASP: Checkbox ID = "chkSubModuleView" checked "true" runat = "server" autostebback = "true" on checked change = "chkSubModuleView_CheckedChanged" / & gt; & Lt; / Th & gt; View & lt; / TR & gt; & Lt; ASP: Place Holder ID = "Item Placeholder" Run = "Server" & gt; & Lt; / Asp: place holder & gt; & Lt; / Table & gt; & Lt; / LayoutTemplate & gt; & Lt; ItemTemplate & gt; & Lt; TR & gt; & Lt; TD & gt; & Lt;% # Eval ("Title")%> & Lt; Asp: HiddenField id = "hfMenuID" value = '& lt;% # Eval ("MenuID")% & gt; Runat = "server" /> & Lt; Asp: HiddenField id = "hfName" value = '& lt;% # Eval ("HeaderID")% & gt; Runat = "server" /> & Lt; / TD & gt; & Lt; TD & gt; & Lt; Asp: check box id = "chkRead" runat = "server" autopostback = "true" checked "true" reason validity = "false" on checked face = "chkRead_CheckedChanged" & gt; & Lt; / Asp: checkboxes & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; / ItemTemplate & gt; & Lt; / ASP: ListView & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; / ItemTemplate & gt; & Lt; / ASP: ListView & gt;    

Your checkbox property

  & lt; Asp: checkbox id = "chkSubModuleView" checked = "true" runat = "server" autopost = "true" key = '& lt;% # Eval ("ID")% & gt; Changes on-checked = "chkSubModuleView_CheckedChanged" />   

Your .cs

  secure void chkSubModuleView_CheckedChanged (Object Sender, EventArgs e) {Checkbox chk = (Checkbox) Sender; String yourID = chk.Attributes ["key"]. ToString (); }    

No comments:

Post a Comment