I
ItNerd
Someone PLEASE HELP ME!!!!!
All I want to do is a simple postback and grab the value from a textbox
on clicking a linkbutton like below, but the value is not writing to the
screen. I am frustrated with this seemingly simple task. I have
enabledviewstate=true on the @Page directive, and I tried using onclick
on the linkbutton, nothing. I know the event is firing because I can
set the value to a hardcoded string and get it to show. In addition, I
have the Page_Load
if (IsPostBack){UserNameLabel.Text = newUserName.Text;}
So I have no idea what the heck is the problem.
public void updateUserName(Object sender, CommandEventArgs e)
{
UserNameLabel.Text = newUserName.Text;
}
<form id=form1 runat=server>
<aspanel ID="userNamePanel" EnableViewState=true Runat="server">
<TR>
<TD>
<asp:label id="UserNameLabel" EnableViewState=True
Runat="server"></asp:label></TD>
<TD>
<asp:textbox id="newUserName" EnableViewState=true
Runat="server"></asp:textbox></TD>
</TR>
</aspanel>
<aspanel ID="updatePanel" Runat="server">
<asp:linkbutton class="lnav1" id="updateUserNameLink"
CommandArgument="shit" OnCommand="updateUserName" runat="server"
Text="Update">
</asp:linkbutton>
</form>
All I want to do is a simple postback and grab the value from a textbox
on clicking a linkbutton like below, but the value is not writing to the
screen. I am frustrated with this seemingly simple task. I have
enabledviewstate=true on the @Page directive, and I tried using onclick
on the linkbutton, nothing. I know the event is firing because I can
set the value to a hardcoded string and get it to show. In addition, I
have the Page_Load
if (IsPostBack){UserNameLabel.Text = newUserName.Text;}
So I have no idea what the heck is the problem.
public void updateUserName(Object sender, CommandEventArgs e)
{
UserNameLabel.Text = newUserName.Text;
}
<form id=form1 runat=server>
<aspanel ID="userNamePanel" EnableViewState=true Runat="server">
<TR>
<TD>
<asp:label id="UserNameLabel" EnableViewState=True
Runat="server"></asp:label></TD>
<TD>
<asp:textbox id="newUserName" EnableViewState=true
Runat="server"></asp:textbox></TD>
</TR>
</aspanel>
<aspanel ID="updatePanel" Runat="server">
<asp:linkbutton class="lnav1" id="updateUserNameLink"
CommandArgument="shit" OnCommand="updateUserName" runat="server"
Text="Update">
</asp:linkbutton>
</form>