Home > Net >  Ever understand the GridView bosses bump of busy
Ever understand the GridView bosses bump of busy

Time:09-26

ASP.NET, use the GridView bound data, why data is not shown, click later, there is no data show that the AutoGenerateColums values into True then there will be a heap of columns, each column a letter, respectively is the SYSTEM... The value of the
The inside of the web code: (Session [" sno "] value is 1 also shows that, in the database have AuthorId is 1)
Public partial class _Default: System. Web. UI. Page
{
UserInsert UserInsert=new UserInsert ();
Protected void Page_Load (object sender, EventArgs e)
{
Lblname. Text="hello!" + Session (" sno "),
}
Public void the bind ()
{
GvMsg. The DataSource=userInsert. GetMyPlanesByAuthorID (Convert ToInt32 (Session (" sno "))). The ToString ();
GvMsg. DataBind ();


}
Protected void btnPlane_Click (object sender, EventArgs e)
{
The bind ();
}
}
The inside of the Bll:
Public List GetMyPlanesByAuthorID (int authorid)
{
Return (from c in the db. MyPlane
Where c.a. uthorID==authorid
Select c) ToList ();

}

CodePudding user response:

The GridView the DataSource is a Table, you userInsert. GetMyPlanesByAuthorID (Convert. ToInt32 (Session [" sno "])). The ToString (); This gadget returns a string, how to bind?

CodePudding user response:

Returns an object, you bound to a table
  • Related