Ask a Question related to ASP.NET Data Grid Control, Design and Development.
-
Josh Behl #1
All my drop down lists get reset to the first value when I go in to edit a record in the datagrid....
I've got my datagrid working to the point where I can edit records and even
pick different values in my dropdownlists, save the record and have that
data committed to the table. The problem I am having is that when I go into
edit a record each of my picklist values get reset to the first value in the
list.
How can I fix this??
Josh Behl
Josh Behl Guest
-
Drop-down lists in a grid
:confused; Hopefully some of the experienced CF developers out there can help me, a newcomer to the delights of CF/Dreamweaver app development!... -
coldfusion drop down lists
i am trying to build a page with two drop down lists. one with user ids, pulling the list of ids from form variables. the other lists is projects,... -
Datagrid with Drop Down Lists
In an asp.net page that has a datagrid, how do you change the data for that column to be listed in a listbox with the current value selected? -
Linked drop down lists
Can anyone tell me how I go about making one list in a form only show relevant details depending what the user chooses in the preceeding list box.... -
2 drop-down lists
Micha wrote: PHP runs on the server. You need client-side scripting, probably Javascript. Cross-posted and followups set. -- Jim Dabell -
cfaul #2
Re: All my drop down lists get reset to the first value when I go in to edit a record in the datagrid....
"Josh Behl" <jbehl@cableone.net> wrote in message news:<#$za6APnDHA.644@TK2MSFTNGP11.phx.gbl>...
Hi Josh> I've got my datagrid working to the point where I can edit records and even
> pick different values in my dropdownlists, save the record and have that
> data committed to the table. The problem I am having is that when I go into
> edit a record each of my picklist values get reset to the first value in the
> list.
>
>
> How can I fix this??
>
> Josh Behl
This is possibly happening because you dont have an 'isPostBack'
condition in your page_load sub. When you push the button to execute,
the page_load sub is called and your dropdownlists will be populated
again, using the first value of the list as the 'selected value'. This
can be fixed by putting the initial page loading code inside the
following if statement:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
'Populate dropdownlist
End If
End Sub
Good luck
cfaul Guest
-
Josh Behl #3
Re: All my drop down lists get reset to the first value when I go in to edit a record in the datagrid....
I am currently populating my drop down lists with a collection of values
which I enter in the html code itself:
<asp:DropDownList id=ddlFee runat="server" Width="80px"
DataMember="OptionRequestCRM" DataSource="" DataTextField="Fee"
DataValueField="OptionID">
<asp:ListItem Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp....etc...
Since I am populating my drop down this way, is there another solution????
"cfaul" <charlene@rgt.co.za> wrote in message
news:e6200ba0.0310272235.266a3781@posting.google.c om...news:<#$za6APnDHA.644@TK2MSFTNGP11.phx.gbl>...> "Josh Behl" <jbehl@cableone.net> wrote in messageeven> > I've got my datagrid working to the point where I can edit records andinto> > pick different values in my dropdownlists, save the record and have that
> > data committed to the table. The problem I am having is that when I gothe> > edit a record each of my picklist values get reset to the first value in>> > list.
> >
> >
> > How can I fix this??
> >
> > Josh Behl
> Hi Josh
>
> This is possibly happening because you dont have an 'isPostBack'
> condition in your page_load sub. When you push the button to execute,
> the page_load sub is called and your dropdownlists will be populated
> again, using the first value of the list as the 'selected value'. This
> can be fixed by putting the initial page loading code inside the
> following if statement:
>
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
>
> If Not IsPostBack Then
> 'Populate dropdownlist
> End If
>
> End Sub
>
> Good luck
Josh Behl Guest
-
Imtiaz Hussain #4
Re: All my drop down lists get reset to the first value when I go in to edit a record in the datagrid....
You can databind the dropdownlist in the code behind file as well.
As charlene mentioned the data might be getting repopulated on postback.
You might want to prevent the datagrid that contains the dropdownlist from
rebinding on postback.
Hope this helps.
Imtiaz Hussain
Imtiaz Hussain Guest
-
Seni Buljat #5
Re: All my drop down lists get reset to the first value when I go in to edit a record
I had Page.IsPostBack and it didin't work. So pay attention that only code on page loadshould be
if not IsPostack and data will be saved correctly
Junior Member
- Join Date
- Sep 2011
- Posts
- 1



Reply With Quote

