问题描述:

what's the reason if I have in GridView ButtonField with own CommandName to show FormView with some row's details and it's show when I click first row and for other rows it doesn't work? I have also other columns with other buttonfields and commandnames and they work correctly for each row....

 protected void gvQuizes_RowCommand(object sender, GridViewCommandEventArgs e)

{

if (e.CommandName == "cnOptions")

{

int index = Convert.ToInt32(e.CommandArgument);

GridViewRow row = gvTestyW.Rows[index];

if (row != null)

{

LinkButton lbtn = row.Cells[5].Controls[0] as LinkButton;

string quizID = gvTestyW.DataKeys[row.RowIndex].Value.ToString();

if (lbtn.Text == "Show")

{

lbtn.Text = "Hide";

fvOptions.Visible = true;

sdsOpcje.SelectCommand = "HERE IS SQL QUERY THAT ENDS WITH: WHERE quizes.Id=" + quizID;

}

else if (lbtn.Text == "Hide")

{

lbtn.Text = "Show";

fvOptions.Visible = false;

}

}

相关阅读:
Top