I have a data grid view and a button in my ASP.net page.
I'm calling this method on button click event.
protected void btnSearch_Click(object sender, EventArgs e)
{
getlbCat();
}
This is lbCat method
public void getlbCat()
{
GVDetails.DataSource = new LibraryCatalogueOP().getLibraryCatalogue();
}
This is my business layer method
public DataTable getLibraryCatalogue()
{
string quary1 = "EXEC SelectLibraryCatalogue";
return new DataAccessLayer().executeTable(quary1);
}
But when I click the button the grid view doesn't fill with data.
How to solve this ?
I'm using visual studio 2010.
Try to call DataBind method of grid
public void getlbCat()
{
GVDetails.DataSource = new LibraryCatalogueOP().getLibraryCatalogue();
GVDetails.DataBind();
}
Silly myself. Sorry if I wasted your time viewers. I have missed the line GVDetails.DataBind();
public void getlbCat()
{
GVDetails.DataSource = new LibraryCatalogueOP().getLibraryCatalogue();
GVDetails.DataBind();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.