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
{
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