I have a GridView
in my asp.net
Applicaiton. i have a Button
with javascript
function which shows the values of selected
row in Div
. How to get all Grid
Column values of Selected Row on ButtonClick
.
Javascript:
function SetRowValues(id, controlid, fair, good, mint, nnew, poor,broken) {
//alert(id + " " + fair + " " + controlid);
$("#divSelectedRow").html("TPCCID: " + id + " Fair:" + fair + " Good: " + good + " Mint: " + mint + " New: " + nnew + " Poor: " + poor + " Broken: " + broken);
$("#divSelectedRow").css("display", "block");
return false;
}
Grid Markup:
<asp:TemplateField HeaderText="Source" ItemStyle-Width="50px" ItemStyle-HorizontalAlign="Center"
HeaderStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Button ID="BtnSource" runat="server" CausesValidation="false" OnClick='<%# "return SetRowValues("+Eval("ttppcid")+",this.id,"+Eval("Fair")+","+Eval("Good")+","+Eval("Mint")+","+Eval("Poor")+","+Eval("Broken")+")"%>' Text="Source" />
</ItemTemplate>
</asp:TemplateField>
Here, i want to get all the column values of selected row
using Javascript
.
Note: When the Value for column1 is string containing Space eg: "Cell Phone" then the script wont work.
Please help me to get the entire row
values using javascript
on Button Click
.
Help Appreciated!