c# - how to get element value inside gridview using javascript -
i have gridview view have label lblprice , textbox txtquanty , 1 more label lblamount.
<asp:gridview id="griditem2" headerstyle-backcolor="#fc8d10" headerstyle-forecolor="white" rowstyle-backcolor="skyblue" alternatingrowstyle-backcolor="white" alternatingrowstyle-forecolor="#000" runat="server" autogeneratecolumns="false" allowpaging="false" onpageindexchanging="griditems_pageindexchanging"> <alternatingrowstyle backcolor="white" forecolor="#000000" /> <columns> <asp:templatefield> <headerstyle width="80px" horizontalalign="center" /> <headertemplate> <p>action</p> </headertemplate> <itemtemplate> <asp:imagebutton runat="server" commandname="cmddel" commandargument='<%#((gridviewrow)container).rowindex %>' height="20" width="20" /> </itemtemplate> <itemstyle width="80px" horizontalalign="center" /> </asp:templatefield> <asp:templatefield visible="false"> <headertemplate> <asp:label runat="server" text="txt"></asp:label> </headertemplate> <itemtemplate> <asp:label runat="server" id="lblitemid" text='<%#eval("itemid") %>'></asp:label> </itemtemplate> </asp:templatefield> <asp:templatefield visible="true"> <headerstyle width="100px" /> <headertemplate> <asp:label runat="server" text="items"></asp:label> </headertemplate> <itemtemplate> <asp:label runat="server" id="lblname" text='<%#eval("name") %>'></asp:label> </itemtemplate> </asp:templatefield> <asp:templatefield visible="true"> <headerstyle width="120px" /> <headertemplate> <asp:label runat="server" text="price"></asp:label> </headertemplate> <itemtemplate> <asp:label runat="server" cssclass="clsprice" id="lblprice" text='<%#eval("price") %>'></asp:label> </itemtemplate> </asp:templatefield> <asp:templatefield visible="true"> <headerstyle width="120px" /> <headertemplate> <asp:label runat="server" text="quantity"></asp:label> </headertemplate> <itemtemplate> <asp:textbox runat="server" onkeyup="myfunctionname(this.value);" cssclass="clsquant" id="txtquant"></asp:textbox> </itemtemplate> </asp:templatefield> <asp:templatefield visible="true"> <headerstyle width="120px" /> <headertemplate> <asp:label runat="server" text="total"></asp:label> </headertemplate> <itemtemplate> <asp:label runat="server" id="lbltotal"></asp:label> </itemtemplate> </asp:templatefield> </columns> <headerstyle backcolor="#3ac0f2" forecolor="white" /> <rowstyle backcolor="#a1dcf2" /> </asp:gridview>
i want fire onkeyup event on txtamount use jquery
function myfunctionname(amount) { var myvalue = ""; myvalue=$('#griditem2 input[type=text]').closest("tr").find(".clsprice").text(); alert(myvalue); }
to label value value of label. not working. please suggest
Comments
Post a Comment