Hi Every One
I am creating dynamic html table in each row second column I am putting link button and in first column I am putting the label in the text property of the label I am setting the serial number my question when any user click the link button I have to read associate serial number of that row
For example if user click on the link button from the third row then I have to read the serial number of that row
Why I need this number because the text which I am displaying is same in all rows I have send this link button text and serial number associated to this row
Does any body have any idea regarding this issue please help me?
Thanks in advances

Kirtan PatelRank #292 · 8.6K reputationPosted Oct 21, 2009, 7:24 AM EDT
let me know i will help you :)
mohdazeemuddin ahmed125 reputationPosted Oct 21, 2009, 9:16 PM EDT
OK will can you tell me how to read the value from grid view
Kirtan PatelRank #292 · 8.6K reputationPosted Oct 21, 2009, 9:25 PM EDT
string X = GridView1.Rows[Indexed].Cells[ColumnIndex].Text;
if it helps you please check "do you like this answer"
Steps
Add Button Column in GridView
Modify Template Field in HTML Code
and Add Code like below In Row_Command Event
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "getSerial")
{
int Rowindex = Convert.ToInt32(e.CommandArgument);
string serial = GridView1.Rows[Rowindex].Cells[1].Text;
Response.Write(serial);
}
}
My Sample Project for you is here Download it and Take a look
download Project Files
Amit ChoudharyRank #145 · 15.8K reputationPosted Oct 22, 2009, 12:46 AM EDT
' AlternateText=''/> ProductID: '> Product Name: '> Description: '> Stock Quantity: '> ' OnClick="RedirectToAuctionPage"/>and code behind of link button click even is like this:
protected void RedirectToAuctionPage(object sender, EventArgs e) { Button b = (Button)sender; int pid=Convert.ToInt32(b.CommandArgument); Session["PPid"] = pid; }Please mark this as answer if it helps you.
mohdazeemuddin ahmed125 reputationPosted Oct 22, 2009, 2:20 AM EDT
i used your code but i am getting run time error at the time of conversion because it doesn't getting any command argument
Kirtan PatelRank #292 · 8.6K reputationPosted Oct 22, 2009, 4:39 AM EDT
take a Look at Project Files i Have Provided :)
it will help you .
but if still having problem just send me your project files (zip) in mail at [email protected]
i will solve your problem quickly :)
Thanks :)