This is aggravating the hell out of me. I'm very new to ASP.NET, I
had this page working yesterday, I don't remember making any changes
to the code, and today its not working. I have a page that retrieves
the user's username, and query's a table for their profile
information, returning the results into textboxes.
The relative parts of my code are below. At the very minimum,
LabelFirstName should be given the text "TEST", however, the label
always shows the text I assigned to it earlier (according to my
understanding). Any help would be greatly appreciated. Thanks
<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master"
debug="true"%>
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs)
SqlDataSource1.SelectParameters.Add("UserName",
System.Web.HttpContext.Current.User.Identity.Name)
End Sub
Protected Sub SqlDataSource1_Selecting(ByVal sender As Object,
ByVal e As System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs)
Username.Text = e.Command.Parameters("@UserName").Value _
& "'s Profile"
LabelFirstName.Text = "TEST"
End Sub
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<div id="editUserInfoContainer" >
<div>
<asp:Label ID="Username" runat="server" Text="Label"></asp:Label>
</div>
<div>
<asp:Label ID="LabelFirstName" runat="server" Text="Label">First
Name:</asp:Label>
<asp:TextBox ID="FirstName" runat="server"></asp:TextBox>
</div>
</div>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$
ConnectionStrings:UserInfoConnectionString %>"
SelectCommand="SELECT * FROM [UserInfo] WHERE ([UserName] =
@UserName)"
onselecting="SqlDataSource1_Selecting" >
</asp:SqlDataSource>
</asp:Content>