Not sure if I understand.
For the dropdownlist, to bind it with a datasource, code is as follows:
<asp
ropDownList ID="DropDownList4" runat="server"
DataSourceID="ObjectDataSource4" Enabled="False" DataTextField="BoundName"
DataValueField="BoundID" AppendDataBoundItems="True" AutoPostBack="True"
OnDataBinding="DropDownList4_DataBinding"
OnSelectedIndexChanged="DropDownList4_SelectedIndexChanged">
</asp
ropDownList>
<asp:ObjectDataSource ID="ObjectDataSource4" runat="server"
OldValuesParameterFormatString="original_{0}"
SelectMethod="GetBounds"
TypeName="odsTableAdapters.tb_BoundsTableAdapter">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList3"
Name="CommuneID" PropertyName="SelectedValue"
Type="Object" />
<asp
arameter Name="ValidFrom" Type="DateTime" />
<asp
arameter Name="ValidTo" Type="DateTime" />
</SelectParameters>
</asp:ObjectDataSource>
I wrote a stored procedure that takes to parameres (@BoundID and
@BoundIdentifier) and based on the @BoundID makes some computation.
All I want to do (but have absolutely no clue how) is when user makes a
selection in the drop down list, take the ID of the selected value, pass it
to the stored procedure, retreive the computed value (yes, by "always 13
chars" I meant it is char(13) datatype) and place it as a text property of a
label.
I assume the code responsible for that must be placed in a
SelectedIndexChanged property of the DropDownList4 control.
Cowboy (Gregory A. Beamer) said:
The binding part is simple:
Label1.Text = ParamBoundIdentifier.Value;
To work through this, you will have to create a data access routine with
two parameters.
1. Input parameter @BoundID
2. Output parameter @BoundIdentifier
Not sure what the "always 13 chars" means, unless you are telling me the
field, in the database, is char(13), which really means very little to me.
Igor said:
Hi
I build a page that has a dropdownlist control bound with data from a
database. When user select an item from the dropdownlist I want a label
to be filled with a result from a stored procedure. The stored procedure
takes an ID of a selected item (@BoundID) from the dropdownlist and gives
a result (@BoundIdentifier) as follows:
---
Running [dbo].[tbh_GetBoundIdentifier] ( @BoundID =
cf44452b-8b05-45da-a7c6-14146fba0356, @BoundIdentifier = <NULL> ).
No rows affected.
(0 row(s) returned)
@BoundIdentifier = 160302_R.0582
@RETURN_VALUE = 0
Finished running [dbo].[tbh_GetBoundIdentifier].
---
The BoundIdentifier is always 13 char long.
How can I do that? I can't find any 'binding' for a label.
I'm new to ASP.NET.