I use viewstate in application where I have found that encapsulating viewstate in property is much more convenient.
Here is the code what I do in my code.
public List<TransactionEntity> TransactionData
{
get
{
if(ViewState["TransactionData"] == null)
return new List<TransactionEntity>();
return _TransactionData as List<TransactionEntity>();
}
set
{
How to set value to gridview from here ??
}
}
Now i have a gridview in user control which I need to bind everytime I assign value to this property.
Anyone knows how to do it. Thanks.
Now i have a gridview in user control which I need to bind everytime I assign value to this property.
Anyone knows how to do it
set
{
ViewState["TransactionData"] = value;
gridview.DataSource = value as List<TransactionEntity>; //check if null etc
gridview.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.