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 PatelPosted Oct 22, 2009, 8:39 AM
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 :)
mohdazeemuddin ahmedPosted Oct 22, 2009, 6:20 AM
i used your code but i am getting run time error at the time of conversion because it doesn't getting any command argument
Amit ChoudharyPosted Oct 22, 2009, 4:46 AM
and code behind of link button click even is like this:
Please mark this as answer if it helps you.
Kirtan PatelPosted Oct 22, 2009, 1:25 AM
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
mohdazeemuddin ahmedPosted Oct 22, 2009, 1:16 AM
OK will can you tell me how to read the value from grid view
Kirtan PatelPosted Oct 21, 2009, 11:24 AM
let me know i will help you :)