How to filter the result thru membership in FormView?

A

A. J.

Hi,

I'm new to ASP.Net 2.0, and 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, Email.

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!

Thanx in advance
A. J.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top