c# - is there better ways to get gridview values? -
for gridview How can I get the value of a cell when I click on a button and sometimes on this button I can be embedded in a gridview line, maybe anywhere else on the page beyond the gridview. My stupid and simple way is to create control of Gridview columns by creating each column as a label type on the client side, so it has something on the server to get values like this text,
This is fine when it's just a few columns, but what if ten If there are more than different columns, should I do this again and again? Is there a better way? I have every gridview Trying to loop through the lights, but there are always empty values, which I do not know why. What you can do You can make an example of the grid row / example, and then you can use the control: "post-text" itemprop = "text" and then use the control Other controls similar label lblName = (label) gvName.Rows [gvName.RowIndex] .FindControl ("lblSomeContent")
GridViewRow gRow = gvName.Rows [gvName.RowIndex];
label lblName = (label) gRow.FindControl ("lblSomeContent");
textbox text box = (text box) gRow.FindControl ("txtSomeContent");
Comments
Post a Comment