Question for a guru from a Newbie Related to use of LoginName1 [userid] value

Discussion in 'ASP.NET 2.0' started by easyrealtya, May 22, 2005.

  1. Can I use thevalue from the LoginName tool in a query on a datagrid. When I go to choose a control when setting a query on my datagrid the Loginname1 object is not a selection. I would love to be able to get a grid of data where a field on the table the grid pulls fromequals the value of the LoginName1 object. I wish the system saw that as a control like it sees a text box. Any workaround would be appreciated!!!

    PS. You guys have been A-Number-1 with getting me off the ground. I wanted to tell anyone who looks at these that you Guys do a great job!!! I am a Newbie with 0 experience and every single time I get stuck you guys are right there GOOD JOB!!!
     
  2. how/where are you setting a query on your grid? (IDE, in-code...)



    Thanks,
    ts
     
  3. When I cofigure the where Select statement in the Where... button you choose the column and then the source . This choose source only sees controls like a text box it will not see the Login name as it not a contol. However I would like to have my grid only show records from a table where a field on that table =


    <asp:LoginName ID="LoginName1" runat="server" />


    So in effect when the user logs in I would like to use that login name to control what data they see on a grid. This would allow the login name to act like a filter for my portal and restrict the logged in person to seeing just the records related to them on the table.


    Can you help?
     
  4. I figured it out. I just put textbox on the screen then a page load


    TextBox1.Text = User.Identity.Name
    now I can use the textbox control in the queries that power the datagrids.
    That


    TextBox1.Text = User.Identity.Name also matches a field value that identifies the records that belong to the logged in useron my SQL table. So in a sense I get to have the aspnet login control do all my dirty work and then the "TextBox1.Text = User.Identity.Name" power my data searchs. Too easy!!! This tool is awsome!!


    I have written one line of code and one sql queryand I have a user logging in and filtered to see just there table data!!!!
     

Share This Page