Auteur de questions
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?
Toutes les réponses
Here is my code, after my test ,it is work well.
<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="SqlDataSource1" DataTextField="Id" DataValueField="Id">
<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]">
In your code, ConnectionString="Data Source=<bla bla>; is not right. It should be your SQL server Database instance name.
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.