Link to home
Start Free TrialLog in
Avatar of rckrch
rckrchFlag for United States of America

asked on

Fill text box with data from datasource in asp.net

I have a text box that I want to fill in code behind vb.net with an sqldatasource defined in asp.net client side.  How to I use this data source in code behind to fill one data point in the text box.  Below is my asp.net code.

Thanks in advance for the help.

<asp:SqlDataSource ID="Die_PtDscDataSource11" runat="server" ConnectionString="<%$ ConnectionStrings:...ions %>"
                                                    ProviderName="<%$ ConnectionStrings:ASTJV...finitions.ProviderName %>"
                                                    SelectCommand="SELECT DieNumber, PartDescription FROM METRICS WHERE Department=@Department AND PartNumber=@PartNumber">
                                                    <SelectParameters>
                                                        <asp:ControlParameter ControlID="DeptDrpDn11" Type="String" />
                                                        <asp:ControlParameter ControlID="PrtNoDrpDn11" Type="String" />
                                                    </SelectParameters>
                                                </asp:SqlDataSource>
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rckrch

ASKER

Thanks Ryan!!

That did work.  Before I close this out would you explain to me how this works.  The "DataSrouceSelectArguments.Empty" confuses me.

Thanks,

Rick
the Select method of SQLDataSource object need to provide with an DataSourceSelectArguments argument, DataSourceSelectArguments.Empty is used to tell that the argument's value is Empty.

DataSourceSelectArguments.Empty Property
https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.datasourceselectarguments.empty?view=netframework-4.7.2
Avatar of rckrch

ASKER

Thanks