I am binding a control which is inside Gridview, using SqlDataSource control as below.
<asp:ComboBox ID="ddlCompany" runat="server" Height="200" Width="240"
DropDownWidth="310" EmptyMessage="- Select Product -" HighlightTemplatedItems="true" CausesValidation="false"
Filter="Contains" AppendDataBoundItems="true" AllowCustomText="true" AutoPostBack="true"
DataTextField="Title" DataValueField="Code" OnSelectedIndexChanged="ddlCompany_SelectedIndexChanged">
</asp:ComboBox>
<asp:SqlDataSource runat="server" ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:MasterDB %>" SelectCommandType="StoredProcedure"
ProviderName="System.Data.SqlClient" SelectCommand="[Invoice].[usp_tbl_AccountCode_DL_Test]">
<SelectParameters>
<asp:Parameter Name="@CompanyCode" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
In above SqlDataSource control, I had to pass the SelectParameter (whose value is
coming from a ComboBox i.e., whatever comboBox value I selcect from ComboBox, its
SelectedValue I had to pass it to the SqlDataSource SelectParameter.
I am first time using "SqlDataSource". Please let me know how to
pass the SelectedValue of ComboBox into SlecteParameter of SqlDataSource
control ??
I hope I made my question clear.
Please reply