javascript - How to find the index of control in datalist -


as datalist controls repeated how can index of each of asp button btnexplodedgroupcode , of telerik radcombobox in datalist(note) radcmbexplodedgroupcodes

  <asp:datalist id="dlexplodedgroupcodes" runat="server" repeatdirection="horizontal"         repeatcolumns="1" cellspacing="4" cellpadding="4">         <itemtemplate>             <asp:button id="btnexplodedgroupcode" runat="server" commandargument='<%# eval("proceduregroupid") %>'                 text='<%# eval("maingroup") %>' width="75px" onclientclick="return checktoochselection();"                 onclick="btnexplodedgroupcode_click" cssclass="rg_button" />             <telerik:radcombobox id="radcmbexplodedgroupcodes" runat="server" datavaluefield="procedureid"                 datatextfield="procedurename" highlighttemplateditems="true" allowcustomtext="false"                 autopostback="true" skin="myblueskin" enableembeddedskins="false" height="200px"                 width="19px" dropdownwidth="298px" nowrap="true" >           </telerik:radcombobox>         </itemtemplate>     </asp:datalist> 

please try below code snippet.

let me know if not understood question.

client side:

js

function checktoochselection(a) {             alert(a);         } 

aspx

 <asp:button id="btnexplodedgroupcode" runat="server" commandargument='<%# eval("name") %>'             text='<%# eval("name") %>' width="75px" onclientclick='<%# "return checktoochselection(" + container.itemindex +");" %>'             cssclass="rg_button"  onclick="btnexplodedgroupcode_click"/> 

server side:

protected void btnexplodedgroupcode_click(object sender, eventargs e) {     int index = ((sender button).namingcontainer datalistitem).itemindex; } 

Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -