Jppinto,
Thanks for your response!
I dont believe it is that part that is the issue. The reason being is that I have used ('" + HttpContext.Current.User.I
) on another page and it does generate the Username. Im not sure i have it in the right place (i.e. public, private, etc.) in addition im not sure that i dont need anything else in front of it or under it etc..... I am very new to C#
I am including the entire code in hopes it will give you more info
Thanks again,
Chan
//moreinfo.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="moreinfo.aspx.cs" Inherits="moreinfo" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:FormView ID="FormView1" runat="server" DataKeyNames="CID"
DataSourceID="SqlDataSource1" DefaultMode="Insert"
onpageindexchanging="FormView1_PageIndexChanging">
<EditItemTemplate>
CID:
<asp:Label ID="CIDLabel1" runat="server" Text='<%# Eval("CID") %>' />
<br />
Fname:
<asp:TextBox ID="FnameTextBox" runat="server" Text='<%# Bind("Fname") %>' />
<br />
Lname:
<asp:TextBox ID="LnameTextBox" runat="server" Text='<%# Bind("Lname") %>' />
<br />
Address:
<asp:TextBox ID="AddressTextBox" runat="server" Text='<%# Bind("Address") %>' />
<br />
City:
<asp:TextBox ID="CityTextBox" runat="server" Text='<%# Bind("City") %>' />
<br />
State:
<asp:TextBox ID="StateTextBox" runat="server" Text='<%# Bind("State") %>' />
<br />
Zip:
<asp:TextBox ID="ZipTextBox" runat="server" Text='<%# Bind("Zip") %>' />
<br />
UserName:
<asp:TextBox ID="UserNameTextBox" runat="server"
Text='<%# Bind("UserName") %>' />
<br />
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True"
CommandName="Update" Text="Update" />
<asp:LinkButton ID="UpdateCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</EditItemTemplate>
<InsertItemTemplate>
Fname:
<asp:TextBox ID="FnameTextBox" runat="server" Text='<%# Bind("Fname") %>' />
<br />
Lname:
<asp:TextBox ID="LnameTextBox" runat="server" Text='<%# Bind("Lname") %>' />
<br />
Address:
<asp:TextBox ID="AddressTextBox" runat="server" Text='<%# Bind("Address") %>' />
<br />
City:
<asp:TextBox ID="CityTextBox" runat="server" Text='<%# Bind("City") %>' />
<br />
State:
<asp:TextBox ID="StateTextBox" runat="server" Text='<%# Bind("State") %>' />
<br />
Zip:
<asp:TextBox ID="ZipTextBox" runat="server" Text='<%# Bind("Zip") %>' />
<br />
<asp:TextBox ID="UserNameTextBox" runat="server"
Text='<%# Bind("UserName") %>' />
<br />
<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True"
CommandName="Insert" Text="Insert" />
<asp:LinkButton ID="InsertCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</InsertItemTemplate>
<ItemTemplate>
CID:
<asp:Label ID="CIDLabel" runat="server" Text='<%# Eval("CID") %>' />
<br />
Fname:
<asp:Label ID="FnameLabel" runat="server" Text='<%# Bind("Fname") %>' />
<br />
Lname:
<asp:Label ID="LnameLabel" runat="server" Text='<%# Bind("Lname") %>' />
<br />
Address:
<asp:Label ID="AddressLabel" runat="server" Text='<%# Bind("Address") %>' />
<br />
City:
<asp:Label ID="CityLabel" runat="server" Text='<%# Bind("City") %>' />
<br />
State:
<asp:Label ID="StateLabel" runat="server" Text='<%# Bind("State") %>' />
<br />
Zip:
<asp:Label ID="ZipLabel" runat="server" Text='<%# Bind("Zip") %>' />
<br />
UserName:
<asp:Label ID="UserNameLabel" runat="server" Text='<%# Bind("UserName") %>' />
<br />
<asp:LinkButton ID="EditButton" runat="server" CausesValidation="False"
CommandName="Edit" Text="Edit" />
<asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False"
CommandName="Delete" Text="Delete" />
<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False"
CommandName="New" Text="New" />
</ItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:BBConnectionString %>"
DeleteCommand="DELETE FROM [MoreUserInfo] WHERE [CID] = @CID"
InsertCommand="INSERT INTO [MoreUserInfo] ([Fname], [Lname], [Address], [City], [State], [Zip]) VALUES (@Fname, @Lname, @Address, @City, @State, @Zip)"
SelectCommand="SELECT [CID], [Fname], [Lname], [Address], [City], [State], [Zip], [UserName] FROM [MoreUserInfo]"
UpdateCommand="UPDATE [MoreUserInfo] SET [Fname] = @Fname, [Lname] = @Lname, [Address] = @Address, [City] = @City, [State] = @State, [Zip] = @Zip, [UserName] = @UserName WHERE [CID] = @CID">
<DeleteParameters>
<asp:Parameter Name="CID" Type="Object" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="Fname" Type="String" />
<asp:Parameter Name="Lname" Type="String" />
<asp:Parameter Name="Address" Type="String" />
<asp:Parameter Name="City" Type="String" />
<asp:Parameter Name="State" Type="String" />
<asp:Parameter Name="Zip" Type="String" />
<asp:Parameter Name="UserName" Type="String" />
<asp:Parameter Name="CID" Type="Object" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="CID" Type="Object" />
<asp:Parameter Name="Fname" Type="String" />
<asp:Parameter Name="Lname" Type="String" />
<asp:Parameter Name="Address" Type="String" />
<asp:Parameter Name="City" Type="String" />
<asp:Parameter Name="State" Type="String" />
<asp:Parameter Name="Zip" Type="String" />
<asp:Parameter Name="UserName" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
</asp:Content>
//moreinfo.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class moreinfo : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
usernametextbox.text = '" + HttpContext.Current.User.Identity.Name + "'
}
}
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163:





by: jppintoPosted on 2009-10-15 at 14:55:12ID: 25585320
Try some of this options:
WindowsIde ntity.GetC urrent().N ame; rrentPrinc ipal.Ident ity.Name; er.Identit y.Name).Pr oviderUser Key
usernametextbox.text = Page.User.Identity.Name;
usernametextbox.text = System.Security.Principal.
usernametextbox.text = System.Threading.Thread.Cu
usernametextbox.text = Membership.GetUser(Page.Us