Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 5th, 2006, 03:56 PM
Authorized User
 
Join Date: Dec 2006
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default sqldatasource parameter and databinding help

Hello:

I have come to a tricky part of my webproject. This maybe a bit confusing.

As of now I have two sqldatasources:

Code:
<asp:SqlDataSource ID="sqlBrokersAgentsRecips" runat="server" ConnectionString="<%$ AppSettings:connectionstring %>" ProviderName="System.Data.SqlClient" SelectCommandType="StoredProcedure" SelectCommand="callcenterdev..spGetBrokersAgentsForRecips">
    <SelectParameters>
        <asp:Parameter Name="OfficeId" DefaultValue="88430760" />
    </SelectParameters>
</asp:SqlDataSource>

<asp:SqlDataSource  ID="sqlMembersOfficeId" runat="server" ConnectionString="<%$ AppSettings:connectionstring %>" ProviderName="System.Data.SqlClient" SelectCommandType="Text" SelectCommand="SELECT m.Office_Number FROM rapdata..Member m WITH(NOLOCK) WHERE Member_Number = @sesBrokerId">
    <SelectParameters>
        <asp:SessionParameter SessionField="sesBrokerId" Name="sesBrokerId" />
    </SelectParameters>
</asp:SqlDataSource>
The sqlMembersOfficeId retrieves the office_number I need correctly, (I know because I have checked the db value and have outputted the value on a label control).

Now the tricky part I am trying to understand is, I need the office_id to be passed for the sqlBrokersAgentsRecips (as you can see I just manually add the value for now to test). Upon doing so I will be able to bind a dropdownlist with the correct members within the office_number.

Code:
<asp:DropDownList ID="BrokerAgentNamesDD" runat="server" DataSourceID="sqlBrokersAgentsRecips" DataTextField="Agent_Name" DataValueField="Member_Number">
</asp:DropDownList>
I know in asp 3.0 you could just sub out all your stored procedures and call them anytime, but looks like its much more elaborate in .NET.

Thanks for your help!
 
Old December 5th, 2006, 05:23 PM
Authorized User
 
Join Date: Dec 2006
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I was doing some reading and it looks like I may need to use SqlDataSourceStatusEventArgs for add the output to a control, variable, ect?






Similar Threads
Thread Thread Starter Forum Replies Last Post
SQLDatasource cymerman ASP.NET 1.0 and 1.1 Basics 1 February 28th, 2008 12:38 AM
sqldatasource imjayakumar Crystal Reports 0 May 19th, 2007 03:12 AM
sqldatasource imjayakumar ASP.NET 2.0 Professional 0 May 19th, 2007 02:58 AM
SqlDataSource Input parameter sg225551 ASP.NET 2.0 Basics 0 January 16th, 2007 10:54 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.