Sending data to User Control from SqlDataSource

Discussion in 'ASP .Net' started by JMO, Mar 13, 2007.

  1. JMO

    JMO Guest

    I'm trying to retreive specific column data from a SqlDataSource
    declared on my aspx page. In turn I want to declare the specific data
    to a variable and then send it to a User Control. The only part that
    I can't get is just being able to retreive the data from the
    SqlDataSource control. I have a custom parameter specified below the
    control as well. If someone could help me out w/ my existing code or
    provide me with a good alternative that would be very helpful. Thanks
    in advance!

    Here is my code:

    aspx

    <%@ Register Assembly="skmParameters" Namespace="skmParameters"
    TagPrefix="skm" %>

    <asp:SqlDataSource ID="HeaderDS" runat="server" ConnectionString="<%$
    ConnectionStrings:MGLoginConnectionString %>"
    DataSourceMode="DataReader"
    SelectCommand="SELECT Fund_Attributes.Fund,
    UserInfo.FundName, UserInfo.FirstName, UserInfo.UserId,
    Fund_Attributes.Logo FROM UserInfo INNER JOIN Fund_Attributes ON
    UserInfo.FundName = Fund_Attributes.Fund WHERE (UserInfo.UserId =
    @UserId)">
    <SelectParameters>
    <skm:MembershipUserIdParameter Name="UserId" /
    >

    <asp:parameter Name="FirstName" Type="String" /
    >

    </SelectParameters>

    codebehind .cs

    void Page_Load(object sender, EventArgs e)
    {

    SqlDataReader reader =
    (SqlDataReader)HeaderDS.Select(DataSourceSelectArguments.Empty);


    while (reader.Read())
    {
    uID = reader["FirstName"].ToString() + "!";
    Fund = reader["Fund"].ToString();
    Logo = reader["Logo"].ToString();
    }
    reader.Close();
    }
     
    JMO, Mar 13, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?VmVhcg==?=
    Replies:
    1
    Views:
    5,061
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    Mar 21, 2006
  2. Guest
    Replies:
    4
    Views:
    6,542
    Walter Wang [MSFT]
    Jul 16, 2006
  3. Carlos
    Replies:
    0
    Views:
    371
    Carlos
    Sep 21, 2006
  4. Mike
    Replies:
    1
    Views:
    372
  5. VB.Net Pro
    Replies:
    2
    Views:
    816
    VB.Net Pro
    Oct 21, 2008
Loading...

Share This Page