Textbox
i have linked datagrid with database,it has 3 columns that is id,name, age. id is primary key i have added textbox whereby when i type id in textbox it display other columns in datagrid,kindly help on how to do so
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Carlos kambuiPosted Mar 4, 2015, 6:20 AM
Nirmal HotaPosted Mar 4, 2015, 5:43 AM
May be this trick would help you.
foreach(DataGridItem item in gridname.Items )
{
TextBox txt = item.Cells[0].FindControl("txtId") as TextBox;
Label lblgridName = item.Cells[0].FindControl("lblName") as Label;
Label lblgridAge = item.Cells[0].FindControl("lblAge") as Label;
//add txt.TextChanged event and assign values to the lables.
}
Hope this helps.