473,385 Members | 2,162 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Basic simple dumb question

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>
<asp:Panel 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>
</asp:Panel>

<asp:Panel ID="updatePanel" Runat="server">
<asp:linkbutton class="lnav1" id="updateUserNameLink"
CommandArgument="shit" OnCommand="updateUserName" runat="server"
Text="Update">
</asp:linkbutton>
</form>

Nov 18 '05 #1
4 1469
I can see some general errors you have
-Why do you have <tr> and <td> within the panel "userNamePanel"?
-You don't have a closing tag for panel "updatePanel"
"ItNerd" <no@no.no> wrote in message news:10*************@news.supernews.com...
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>
<asp:Panel 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>
</asp:Panel>

<asp:Panel ID="updatePanel" Runat="server">
<asp:linkbutton class="lnav1" id="updateUserNameLink"
CommandArgument="s**t" OnCommand="updateUserName" runat="server"
Text="Update">
</asp:linkbutton>
</form>

Nov 18 '05 #2
Typos when I cut and paste. It is correct and when I test the event
using a hardcoded value rather than trying to grab the textbox value it
works fine.

I just want to grab the textbox value, and I am still frustrated.
Thanks in advance for any help you can provide.
Raterus wrote:
I can see some general errors you have
-Why do you have <tr> and <td> within the panel "userNamePanel"?
-You don't have a closing tag for panel "updatePanel"
"ItNerd" <no@no.no> wrote in message news:10*************@news.supernews.com...
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>
<asp:Panel 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>
</asp:Panel>

<asp:Panel ID="updatePanel" Runat="server">
<asp:linkbutton class="lnav1" id="updateUserNameLink"
CommandArgument="s**t" OnCommand="updateUserName" runat="server"
Text="Update">
</asp:linkbutton>
</form>



Nov 18 '05 #3
I think your problem is here

if (IsPostBack){UserNameLabel.Text = newUserName.Text;}

Don't do that, these constructs usually look like this

if (!IsPostBack)
{
// do procedures only to be done first time page is loaded
}

Then keep your updateUserName the same, hopefully will work then.
"ItNerd" <no@no.no> wrote in message news:10*************@news.supernews.com...
Typos when I cut and paste. It is correct and when I test the event
using a hardcoded value rather than trying to grab the textbox value it
works fine.

I just want to grab the textbox value, and I am still frustrated.
Thanks in advance for any help you can provide.


Raterus wrote:
I can see some general errors you have
-Why do you have <tr> and <td> within the panel "userNamePanel"?
-You don't have a closing tag for panel "updatePanel"


"ItNerd" <no@no.no> wrote in message news:10*************@news.supernews.com...
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>
<asp:Panel 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>
</asp:Panel>

<asp:Panel ID="updatePanel" Runat="server">
<asp:linkbutton class="lnav1" id="updateUserNameLink"
CommandArgument="s**t" OnCommand="updateUserName" runat="server"
Text="Update">
</asp:linkbutton>
</form>



Nov 18 '05 #4
Thanks for the tip. I finally got it to work. The problem was
that I had <form> tags inside of my <form runat=server> tag.

I suppose the viewstate had no idea which form I meant to grab data from
and couldn't find it by the name.

Raterus wrote:
I think your problem is here

if (IsPostBack){UserNameLabel.Text = newUserName.Text;}

Don't do that, these constructs usually look like this

if (!IsPostBack)
{
// do procedures only to be done first time page is loaded
}

Then keep your updateUserName the same, hopefully will work then.
"ItNerd" <no@no.no> wrote in message news:10*************@news.supernews.com...
Typos when I cut and paste. It is correct and when I test the event
using a hardcoded value rather than trying to grab the textbox value it
works fine.

I just want to grab the textbox value, and I am still frustrated.
Thanks in advance for any help you can provide.
Raterus wrote:

I can see some general errors you have
-Why do you have <tr> and <td> within the panel "userNamePanel"?
-You don't have a closing tag for panel "updatePanel"
"ItNerd" <no@no.no> wrote in message news:10*************@news.supernews.com...
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>
<asp:Panel 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>
</asp:Panel>

<asp:Panel ID="updatePanel" Runat="server">
<asp:linkbutton class="lnav1" id="updateUserNameLink"
CommandArgument="s**t" OnCommand="updateUserName" runat="server"
Text="Update">
</asp:linkbutton>
</form>


Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Blair Hall | last post by:
I have a requirement to prevent 'accidental' tampering with some software written in Python. If I ensure that all of the modules concerned are compiled into .pyc's, and remove the .py's to another...
5
by: ItNerd | last post by:
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...
4
by: CSharpguy | last post by:
I'm not sure if this is the correct forum or not, but I have a basic question. Currently we have are doing calculations via stored procedures and then returning the results back to the client in...
4
by: dba_222 | last post by:
Dear Experts, Ok, I hate to ask such a seemingly dumb question, but I've already spent far too much time on this. More that I would care to admit. In Sql server, how do I simply change a...
3
by: o.o.Pb.o.o | last post by:
The title is pretty vague, I couldn't agree on how to word my inquiry correctly, but I can explain. I'm writing a simple wiki script that is contained in one HTML file (yes, it's been done before)....
4
by: theapeman | last post by:
Sorry to bore everyone with this question, which I'm sure is the equivalent of "Please help! What letter comes between C and E in the alphabet?" but seriously, if you really didn't know that, I don't...
28
by: Randy Reimers | last post by:
(Hope I'm posting this correctly, otherwise - sorry!, don't know what else to do) I wrote a set of programs "many" years ago, running in a type of basic, called "Thoroughbred Basic", a type of...
30
by: galiorenye | last post by:
Hi, Given this code: A** ppA = new A*; A *pA = NULL; for(int i = 0; i < 10; ++i) { pA = ppA; //do something with pA
7
by: CSharper | last post by:
Yesterday I had a heated discussion with my colleagues on what is a data centric application and having business logic in sql. I have group of people who wants to include all the business logic in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.