Hi,
I am using a dropdownlist in my asp.net proj. By default i have many listitem values listed.
code is similar to:
admin.aspx
<asp:dropdownlist id="lstStudyType" runat=server autopostback=True >
<asp:listitem value="All">All </asp:listitem>
<asp:listitem value="Marketplace research tool (Q1 2005)">Marketplace research tool (Q1 2005)</asp:listitem>
<asp:listitem value="Bay Area, California, USA (Q2 2005)">Bay Area, California, USA (Q2 2005)</asp:listitem>
<asp:listitem value="Baldwin Park Visit">Baldwin Park Visit</asp:listitem>
</asp:dropdownlist>
I am redirecting to this page from another page(EditRequestStudy) with a query string value: admin.aspx?RequestStudy=<StudyType>.. this study type is decided at run time.. Normally when the admin.aspx page is loaded the dropdownlist is databinded from a database which has 5 types of RequestStudy. The sql query used to populate the ddl is <Select RequestStudy, DisplayOrder From VisitInfo Order By DisplayOrder>, so the deafult values in the list item is not shown in the ddl.
so always a particular RequestStudy(say test visit) comes first in the ddl.
So whenever i redirect to admin.aspx from EditRequestStudy always the test visit comes first in the ddl and not that corresponding requeststudy which i had edited.
So to do that i tried to use the following code in my admin.aspx..
ddlID.Items.Insert(0, "Park Visit"); [ say Park Visit is the one that i edited]
ddlID.AppendDataBoundItems = true;
also i used to following SQl query..
<Select RequestStudy,DisplayOrder From VisitInfo WHERE RequestStudy!='"+Park Visit+"'"+" ORDER by DisplayOrder>
But when i run it, the Park visit is first shown in my ddl, but also the default values in the list item also comes up, which i do not want..
Is there any way in which i culd have my park visit come up first in the ddl, and only those in the database as the rest of the values in the ddl..
I realize some parts may not be clear.. but i hope i have tried to clear my prob..
Thanks,
Nitin..