DataGrid

G

Guest

I have a rather complicated problem I need to sort out and wonder if anyone
can assist me.

The ingredients:

Two DropDownList Controls
One DataGrid

Purpose of Page:

User selects a menu using a DropDownList Control (DDLMenu). Depending on
the selection another DropDownList Control(DDLSection) appears revealing the
sub-selections available to DDLMenu. Once a selection is made with
DDLSection a DataGrid appears with the data that is available to the
selection in DDLSection. The user is able to edit the data in the DataGrid
by either pressing Delete or the Edit buttons in the datagrid as the user
would with any standard DataGrid.

Problem with the page:

When the user clicks on Edit or Delete on the DataGrid(dgCMS) Both
DropDownList selections are lost or one or the other is kept while the other
is lost. I believe the problem lies with rebinding the DropDownList to the
users' selection. If someone could be so kind to tell me or guide me in the
correct direction in maintaining the users selection on rebind or let me know
of a tutorial in C#. I would be truly greatful. Thank you in advance.

Sam-
 
S

Sharon

Hi Sam.
It's hard to tell what the problem is, without the source.
Maybe you are reseting the drop down on page load,
without checking IsPostback?
Sharon.
 
G

Guest

Hi Sharon,

I would provide the source code but it is very long(over 300 lines). I
placed the DropDownList DataBind in a seperate method called BindData() then
called it in Page_Load() after testing if page (!IsPostBack) so I know that
isn't the problem. I think I should create two seperate methods that rebinds
the DropDowns based on user selection but I'm worried about continual calls
to the database. So I am also thinking of stuffing the Data information into
an array and binding the array to the DropDowns instead. I'm not sure though.
 
J

Jimmy

sounds like you 're not maintaining the state of your listboxes after the
postback

ch Jim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top