Solved

flow problem

Posted on 2004-03-23
10
205 Views
Last Modified: 2010-04-15
oninit()

load form...

oninit() again

reload form ...


IsPostBack()
{

}

submitbutton_event(){
getvalues from form
createdatagrid();

}


DataGridsortevent(){
createdatagrid();
}


DataGridpagingevent
{
createdatagrid();
}


GridItemDataBound()
{
//do adding
}

everytime i click on a datagrid event(sorting,paging) it will go trough oninit() , recreate original form and lose datagrid..  so, is there a way to find out if the datagrid exists on the form? i'm trying to use viewstate/setting a variable and nothing, not sure either that's a good way to do it.. thank you
0
Comment
Question by:alain123
  • 5
  • 3
  • 2
10 Comments
 
LVL 9

Expert Comment

by:msdixon
ID: 10659680
i assume this is asp.net...

in your init method do the following:

protected void Page_OnInit(object sender, EventArgs e)
{
   if (!Page.IsPostBack)
   {
      // build your grid here
   }
}
0
 
LVL 1

Author Comment

by:alain123
ID: 10660577
hi ms,

yes it's asp .net c#..

if i do that then it will build/add the datagrid to the form there, and it will then go to

submitbutton_event(){    
getvalues from form  --> will fail, form will not exist
createdatagrid();

}
 the form will be the datagrid, i won't be able to capture the values from the user....
0
 
LVL 9

Expert Comment

by:msdixon
ID: 10660754
actually it will exist. i usually use the page load event to build my grids, but it should have the same effect using page init. the view state will have all the information in the grid.

did you try it?

maybe there's something in your method that you need to do every time the page is loaded, not just the initial occurrence.
0
 
LVL 1

Author Comment

by:alain123
ID: 10660885
yes i did tried ...  i agree with you, the datagrid will exists, but the original form with the userinfo dissapears.. which is what i need before loading the datagrid
0
 
LVL 9

Expert Comment

by:msdixon
ID: 10661041
if you post some more code i can take a look at it.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Author Comment

by:alain123
ID: 10661377
hmm i wish i could ms, it's way too big and distributed among multiple classes..
0
 
LVL 9

Expert Comment

by:msdixon
ID: 10662004
well..... without taking a look at some code.... it appears that something you're calling in your init event needs to be called on every load and the databinding stuff doesn't. i know that doesn't really help a whole lot.
0
 
LVL 20

Accepted Solution

by:
TheAvenger earned 500 total points
ID: 10707255
Post
0
 
LVL 9

Expert Comment

by:msdixon
ID: 10707485
Post?

that's the answer?
0
 
LVL 20

Expert Comment

by:TheAvenger
ID: 10707656
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now