Forum Moderators: open

Message Too Old, No Replies

How to filter the result thru membership in FormView?

         

ajifri

11:43 am on Jul 16, 2006 (gmt 0)

10+ Year Member



Dears,

I have two pages login.aspx which contain the membership login control with SQL database, and second page data.aspx which contain FormView.

I need to use SessionParameter to pass the UserName and do some filteration to display the required information.

The fields are UserName, Passwords, Email, Address.

Any help?

wardbekker

7:54 am on Jul 17, 2006 (gmt 0)

10+ Year Member



After validation, you should put the values of your e-mail, username etc. fields in the session objects.

The keys under which they are stored can be used for the SessionParameter configuration.

ajifri

9:28 am on Jul 17, 2006 (gmt 0)

10+ Year Member



Thank you wardbekker,

here is my code in data.aspx.c

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
String UserName = Page.User.Identity.Name;
Response.Write(UserName);
}
}

regarding the dayasource code in the formview I wrote:

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ASPNETDBConnectionString %>"
SelectCommand="SELECT UserName, Email, Phone FROM Data WHERE UserName = @UserName)">
<SelectParameters>
<asp:SessionParameter Name="UserName" SessionField="UserName" Type="String" Size="50" />
</SelectParameters>
</asp:SqlDataSource>

The problem that when I check the session by using
Response.Write(UserName);
it will disply it correctly, but I can't pass it to the SQL and all what I got is blank page!

Thank you again

ajifri

11:52 pm on Jul 20, 2006 (gmt 0)

10+ Year Member



Any help guys?