hello guys how r u ?
i am in some problem here
my questions is that,
i have an gridview which is being load on behalf of behalf of dropdownlist and i have an update linkbutton, when i press update linkbutton then the other gridview should load but only one column of 1st gridview should load in second gridview
my code is below,
protected void lbnUpdate_Click(object sender, EventArgs e)
{
foreach (GridViewRow gvr in GridView1.Rows)
{
string answerText = gvr.Cells[3].Text;
//Response.Write("
" + answerText);
foreach (GridViewRow gvr2 in GridView2.Rows)
{
((TextBox)gvr2.Cells[3].FindControl("txtAnswers")).Text = answerText;
}
}
ModalPopupExtender1.Show();
}
this code is running perfect with out any error but the second gridview was not loading
please i need some help from you
Reply Soon
its urgent
thanks.
Loading
Amit ChoudharyPosted Jul 20, 2011, 5:40 AM
foreach (GridViewRow gvr2 in GridView2.Rows)
{
((TextBox)gvr2.Cells[3].FindControl("txtAnswers")).Text = answerText;
}
Check the value of GridView2.Row see if its having any row? And if its 0 then you have to create some rows in the Gvr2 first.
To add rows into grid programmetically then you should follow this article "New Rows in GridView".
Hope this helped you.