N Khan
N Khan

Reputation: 366

DataTable loses data when called in another form

I have two webform say wf1 and wf2,

I've data in wf1 gridview gv1, Now i'm trying to copy this data to another form like

wf2.gv2.DataSource=gv1.DataSource; 
wf2.gv2.DataBind(); 

if I see using breakpoint, I have data in gv2 of wf2, but when i try to view that gv2 in wf2, there is no record in it. In wf2 i have added

 myDiv.Controls.Add(gv2); 

Hope you understand my question. Can you tell me why, I'm struck in this issue for 3 days

Upvotes: 0

Views: 82

Answers (1)

Nipun Ambastha
Nipun Ambastha

Reputation: 2573

gv1 is not persistence and loosing its state.

What you need to check is : when page is rendered completely gv1 have lost it values as you are on other web form. You need to find different approach or try out playing with Page load methods

Upvotes: 1

Related Questions