sam

sam

  • NA
  • 202
  • 0

Display/capture loginname value in textbox

Sep 13 2010 11:09 PM
Hi.
I have a code here where the loginname will display the computer name.
I have another textbox,where i want the same loginname value to be displayed in the textbox.

Any ideas on how to do this,guys?

Here's my code :

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:LoginView ID="LoginView1" runat="server">
            <LoggedInTemplate>
                <br />
                <br />
                <br />
                welcome
<asp:LoginName ID="LoginName1" runat="server" />//THIS LOGIN NAME TO BE DISPLAYED IN TEXTBOX 2 BELOW
<br /> <br /> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ASPNETDBConnectionString %>" SelectCommand="SELECT [ApplicationName], [LoweredApplicationName] FROM [vw_aspnet_Applications]"> </asp:SqlDataSource> <br /> <asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource1"> <EditItemTemplate> ApplicationName:
<asp:TextBox ID="ApplicationNameTextBox" runat="server" Text='<%# Bind("ApplicationName") %>' /> <br /> LoweredApplicationName:
<asp:TextBox ID="LoweredApplicationNameTextBox" runat="server" Text='<%# Bind("LoweredApplicationName") %>' /> <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> ApplicationName:
<asp:TextBox ID="ApplicationNameTextBox" runat="server" Text='<%# Bind("ApplicationName") %>' /> <br /> LoweredApplicationName:
<asp:TextBox ID="LoweredApplicationNameTextBox" runat="server" Text='<%# Bind("LoweredApplicationName") %>' /> <br /> <br /> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <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> ApplicationName:
<asp:Label ID="ApplicationNameLabel" runat="server" Text='<%# Bind("ApplicationName") %>' /> <br /> LoweredApplicationName:
<asp:Label ID="LoweredApplicationNameLabel" runat="server" Text='<%# Bind("LoweredApplicationName") %>' /> <br /> <asp:TextBox ID="TextBox2" runat="server" ToolTip="TextBox2"></asp:TextBox>//DISPLAY LOGINNAME VALUE ABOVE INTO THISTEXTBOX
<br /> <br /> </ItemTemplate> </asp:FormView> <br /> </LoggedInTemplate> <AnonymousTemplate> please login<br /> <br /> <br /> <asp:Login ID="Login1" runat="server"> </asp:Login> <br /> <br /> <br /> </AnonymousTemplate> </asp:LoginView> </div> </form> </body> </html>


Answers (4)