none
unable to display value selected from asp.net dropdown list control in SPD 2007

    Question

  • Hello again!

    I have 3 custom forms named- custom Cust_NewForm.aspx, Cust_Edit.aspx and Cust_DispForm.aspx.

    In Cust_NewForm.aspx form i have a asp.net DropDownlist which I configured to SQLDataSoure to retrieve a list of values (E.g CustID). It is happy until i submit it as a new item.

    asp DDL tag: <asp:DropDownList runat="server" id="DropDownList1" DataValueField="Description" DataTextField="Description" DataSourceID="SqlDataSource1" />

    <asp:SqlDataSource runat="server" ID="SqlDataSource1" ProviderName="System.Data.SqlClient" ConnectionString="Data Source=<bla bla>;Initial Catalog=bla;Persist Security Info=True;User ID=bla;Password=bla" SelectCommand="SELECT DISTINCT [bla] FROM [bla]" />

    Problem is, i am unable to get the value displayed  which i selected ( In Cust_NewForm.aspx - "CustId" in this context) inside the Cust_DispForm.aspx and within Cust_EditForm.aspx.

    BTW, i did not change the Field property to asp.net DropDownlist in Cust_DispForm.aspx. Should i be doing the same how i changed in Cust_NewForm.aspx?

    am I missing anything in here?

    Any help please?

    mardi 13 mars 2012 00:45

Toutes les réponses

  •  

    Hi Kiran,

    Here is my code, after my test ,it is work well.

    <asp:DropDownList ID="DropDownList1" runat="server"

                DataSourceID="SqlDataSource1" DataTextField="Id" DataValueField="Id">

            </asp:DropDownList>

            <asp:SqlDataSource ID="SqlDataSource1" runat="server"

                ConnectionString="Data Source=JACK-7716F30E37;Initial Catalog=WSS_Content_2012;User ID=sa;Password=123!@#ghy"

                ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM [AllDocs]">

            </asp:SqlDataSource>

    In your code, ConnectionString="Data Source=<bla bla>;  is not right. It should be your SQL server Database instance name.

    Thanks,

    Jack

    mercredi 14 mars 2012 03:01
  • Jack thanks for your time!

    DataSource that i mentioned <bla> is just a dummy actual database names are disclosed.

    BTW, just to reiterate my problem:

    I am able to setup the datasource to a asp form field, but, the value i selected from drop down list is unable to bind to the field when i submit the "New Item" in SP.

    jeudi 15 mars 2012 00:19
  • Hi kiran,

    Could you please add AutoPostBack="true" in your Dropdown List? I think when you submit the "New Item", it will refresh then page.

    Thanks,

    Jack


    jeudi 15 mars 2012 01:14
  • didn't work. 

    Do i have to make any changes in Edit and Display forms?

    vendredi 16 mars 2012 06:55