Showing posts with label page. Show all posts
Showing posts with label page. Show all posts

Saturday, March 31, 2012

Text box

Could someone help me.

After hitting the submit page how do get the text box to clear? The
page is posting back to itself. What do I put on the code behind page?Just change the "EnableViewState" property of the Textbox to "False" in the
Properties Windows at design-time. No code necessary.

"JJ297" <nc297@.yahoo.comwrote in message
news:1193771080.275874.158090@.y42g2000hsy.googlegr oups.com...

Quote:

Originally Posted by

Could someone help me.
>
After hitting the submit page how do get the text box to clear? The
page is posting back to itself. What do I put on the code behind page?
>


"JJ297" <nc297@.yahoo.comwrote in message
news:1193771080.275874.158090@.y42g2000hsy.googlegr oups.com...

Quote:

Originally Posted by

After hitting the submit page how do get the text box to clear? The
page is posting back to itself.


The submit page...?

Quote:

Originally Posted by

What do I put on the code behind page?


What are you trying to do exactly...?

Please clarify precisely what you mean...

--
Mark Rae
ASP.NET MVP
http://www.markrae.net
IMO it won't work as persisting the texbox content is not done using
viewstate. By design field values are posted to a server (this is how an
HTML form works). The viewstate is there for any other property you could
have to maintain between postbacks except the textbox content).

Your best bet is to explicitelty set the value to an empty string in the
submit button event handler...

--
Patrice

"Scott M." <s-mar@.nospam.nospama crit dans le message de news:
udr8XiyGIHA.1184@.TK2MSFTNGP04.phx.gbl...

Quote:

Originally Posted by

Just change the "EnableViewState" property of the Textbox to "False" in
the Properties Windows at design-time. No code necessary.
>
>
"JJ297" <nc297@.yahoo.comwrote in message
news:1193771080.275874.158090@.y42g2000hsy.googlegr oups.com...

Quote:

Originally Posted by

>Could someone help me.
>>
>After hitting the submit page how do get the text box to clear? The
>page is posting back to itself. What do I put on the code behind page?
>>


>
>


Just add this to your code:
MyTextBox.text=""

--

David Wier
http://aspnet101.com
http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no
bloated markup

"JJ297" <nc297@.yahoo.comwrote in message
news:1193771080.275874.158090@.y42g2000hsy.googlegr oups.com...

Quote:

Originally Posted by

Could someone help me.
>
After hitting the submit page how do get the text box to clear? The
page is posting back to itself. What do I put on the code behind page?
>


On Oct 30, 3:37 pm, "David Wier" <d...@.dw.comwrote:

Quote:

Originally Posted by

Just add this to your code:
MyTextBox.text=""
>
--
>
David Wierhttp://aspnet101.comhttp://iWritePro.com- One click PDF, convert .doc/.rtf/.txt to HTML with no
bloated markup
>
"JJ297" <nc...@.yahoo.comwrote in message
>
news:1193771080.275874.158090@.y42g2000hsy.googlegr oups.com...
>
>
>

Quote:

Originally Posted by

Could someone help me.


>

Quote:

Originally Posted by

After hitting the submit page how do get the text box to clear? The
page is posting back to itself. What do I put on the code behind page?- Hide quoted text -


>
- Show quoted text -


Thanks I added the text to my code and the box is now clear after
hitting the submit button.
On Oct 30, 3:37 pm, "David Wier" <d...@.dw.comwrote:

Quote:

Originally Posted by

Just add this to your code:
MyTextBox.text=""
>
--
>
David Wierhttp://aspnet101.comhttp://iWritePro.com- One click PDF, convert .doc/.rtf/.txt to HTML with no
bloated markup
>
"JJ297" <nc...@.yahoo.comwrote in message
>
news:1193771080.275874.158090@.y42g2000hsy.googlegr oups.com...
>
>
>

Quote:

Originally Posted by

Could someone help me.


>

Quote:

Originally Posted by

After hitting the submit page how do get the text box to clear? The
page is posting back to itself. What do I put on the code behind page?- Hide quoted text -


>
- Show quoted text -


Thanks it worked!

Text Box

I have a asp.net textbox on my page with a default value in it. I would like
the box to be cleared when some one clicks on the box.
How do I go about doing this?you need to add some client-side javascript like this:

onfocus=" if ( this.value == 'some default' ) this.value=''; " onblur="
if ( this.value == '' ) this.value = 'some default' ; "

Lou Civitella wrote:

Quote:

Originally Posted by

I have a asp.net textbox on my page with a default value in it. I would like
the box to be cleared when some one clicks on the box.
How do I go about doing this?

Text Box and Image Button

Hello,

I added a TextBox and an Image Button to a page so that they are side
by side.
Instead of both being top aligned the Text Box is pushed down.

Why is that?
How can I solve this?

Thanks,
MiguelHi there again,

<asp:ImageButton ID="ImageButton1" runat="server" ImageAlign="Top" />
<asp:TextBox ID="TextBox2" runat="server" />

or

<table>
<tr>
<td valign="top">
<asp:ImageButton ID="ImageButton2" runat="server" />
</td>
<td valign="top">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
</tr>
</table>

or

<div>
<div style="float:left">
<asp:ImageButton ID="ImageButton3" runat="server" />
</div>
<asp:TextBox ID="TextBox3" runat="server" />
</div>
--
Milosz

"shapper" wrote:

Quote:

Originally Posted by

Hello,
>
I added a TextBox and an Image Button to a page so that they are side
by side.
Instead of both being top aligned the Text Box is pushed down.
>
Why is that?
How can I solve this?
>
Thanks,
Miguel
>
>

Text Box and Image Button

Hello,
I added a TextBox and an Image Button to a page so that they are side
by side.
Instead of both being top aligned the Text Box is pushed down.
Why is that?
How can I solve this?
Thanks,
MiguelHi there again,
<asp:ImageButton ID="ImageButton1" runat="server" ImageAlign="Top" />
<asp:TextBox ID="TextBox2" runat="server" />
or
<table>
<tr>
<td valign="top">
<asp:ImageButton ID="ImageButton2" runat="server" />
</td>
<td valign="top">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
</tr>
</table>
or
<div>
<div style="float:left">
<asp:ImageButton ID="ImageButton3" runat="server" />
</div>
<asp:TextBox ID="TextBox3" runat="server" />
</div>
--
Milosz
"shapper" wrote:

> Hello,
> I added a TextBox and an Image Button to a page so that they are side
> by side.
> Instead of both being top aligned the Text Box is pushed down.
> Why is that?
> How can I solve this?
> Thanks,
> Miguel
>

Text box and Gridview on same page

How do I get the validation not to fire if I'm updating a gridview on
the page. When I try to update the item in the gridview the text box
won't allow me to update because of its validation set for that text
box. How do I get around this I need the validation on the text box
too. Here's my page.
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<center style="color: #006666">
<strong><span style="font-family: Arial; text-decoration:
underline">
Add a Topic</span></strong></center>
<center>
<asp:Label ID="Lbloutcome1" runat="server" ForeColor="Red"></
asp:Label> </center>
<center>
<asp:TextBox ID="TopicTxt" runat="server" TextMode="MultiLine"
Width="334px" EnableViewState="False" CausesValidation="True"></
asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
runat="server" ControlToValidate="TopicTxt"
ErrorMessage="Enter a Topic">
*</asp:RequiredFieldValidator><br />
<asp:Label ID="LblMsg" runat="server"></asp:Label><br />
<asp:ValidationSummary ID="ValidationSummary1" runat="server" /
>
<br />
<asp:Button ID="Button1" runat="server" Text="Submit" />
<asp:Button ID="Button2" runat="server" Text="Reset"
CausesValidation="False" />
<br />
<br />
<asp:Label ID="Lbloutcome" runat="server" ForeColor="Red"
Width="237px"></asp:Label><br />
<asp:Label ID="Lbloutcome3" runat="server" ForeColor="Red"></
asp:Label><br />
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False" DataKeyNames="classificationid"
DataSourceID="TopicsSqlDataSource"
AutoGenerateEditButton="True" BorderColor="#8E7953" BorderWidth="1px"
Width="209px" EnableViewState="False">
<Columns>
<asp:TemplateField HeaderText="Topic"
SortExpression="description">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server"
Text='<%# Bind("description") %>' Height="46px" Width="239px"></
asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<
%# Bind("description") %>'></asp:Label>
</ItemTemplate>
<ItemStyle BorderColor="#8E7953"
BorderStyle="Solid" />
<HeaderStyle BorderColor="#8E7953" Font-
Bold="True" Font-Size="Large" ForeColor="#006666" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Delete Topic"
InsertVisible="False" SortExpression="classificationid">
<ItemTemplate>
<asp:Label ID="classificationid"
runat="server" Font-Bold="True" Text='<%# DataBinder.Eval
(Container.DataItem, "classificationID") %>'
Visible="False"></asp:Label>
<asp:CheckBox ID="deleteRec" runat="server"
Font-Bold="True" />
</ItemTemplate>
<ItemStyle BorderColor="#8E7953" />
<HeaderStyle BorderColor="#8E7953" Font-
Bold="True" Font-Size="Large" ForeColor="#006666" />
</asp:TemplateField>
</Columns>
</asp:GridView>
<br />
<br />
<asp:Button ID="Button3" runat="server" Text="Delete
Topic" CausesValidation="False" /><br />
<br />
<br />
<strong><span style="font-size: 14pt; color: #006666; font-
family: Arial; text-decoration: underline">
</span></strong>
<br />
<a href="http://links.10026.com/?link=AddTitle_Description.aspx" id="AddResourceAdminLink"
runat="server">Add a Resource</a><br />
<br />
<a href="http://links.10026.com/?link=EditResoureLibrary.aspx" id="EditResourceAdminLink"
runat="server">Edit Resource Library Information</a><br />
<br />
<br />
<table>
<tr>
<td style="width: 100px">
<a href="http://links.10026.com/?link=http://philanet/">
<img alt="PhilaNet" border="0" src="http://pics.10026.com/?src=Images/
philanet_small.gif" /></a></td>
<td style="width: 175px">
<a href="http://links.10026.com/?link=ResourceLibrary.aspx"><strong><span
style="font-size: 14pt">Resource Library</span></strong></a></td>
</tr>
</table>
<br />
<asp:SqlDataSource ID="TopicsSqlDataSource"
runat="server" ConnectionString="<%$
ConnectionStrings:TrainUserConnectionStr
ing %>"
SelectCommand="GetClassifications"
SelectCommandType="StoredProcedure" UpdateCommand="UpdateTopic"
UpdateCommandType="StoredProcedure">
<UpdateParameters>
<asp:Parameter Name="classificationID" Type="Int32" />
<asp:Parameter Name="description" Type="String" />
</UpdateParameters>
</asp:SqlDataSource>
<br />
</center>
</asp:Content>Checkout the ValidationGroup property.
"JJ297" <nc297@.yahoo.com> wrote in message
news:1194986781.386224.323330@.o3g2000hsb.googlegroups.com...
> How do I get the validation not to fire if I'm updating a gridview on
> the page. When I try to update the item in the gridview the text box
> won't allow me to update because of its validation set for that text
> box. How do I get around this I need the validation on the text box
> too. Here's my page.
> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
> Runat="Server">
> <center style="color: #006666">
> <strong><span style="font-family: Arial; text-decoration:
> underline">
> Add a Topic</span></strong></center>
> <center>
> <asp:Label ID="Lbloutcome1" runat="server" ForeColor="Red"></
> asp:Label> </center>
> <center>
> <asp:TextBox ID="TopicTxt" runat="server" TextMode="MultiLine"
> Width="334px" EnableViewState="False" CausesValidation="True"></
> asp:TextBox>
> <asp:RequiredFieldValidator ID="RequiredFieldValidator1"
> runat="server" ControlToValidate="TopicTxt"
> ErrorMessage="Enter a Topic">
> *</asp:RequiredFieldValidator><br />
> <asp:Label ID="LblMsg" runat="server"></asp:Label><br />
> <asp:ValidationSummary ID="ValidationSummary1" runat="server" /
> <br />
> <asp:Button ID="Button1" runat="server" Text="Submit" />
> <asp:Button ID="Button2" runat="server" Text="Reset"
> CausesValidation="False" />
> <br />
> <br />
> <asp:Label ID="Lbloutcome" runat="server" ForeColor="Red"
> Width="237px"></asp:Label><br />
> <asp:Label ID="Lbloutcome3" runat="server" ForeColor="Red"></
> asp:Label><br />
> <asp:GridView ID="GridView1" runat="server"
> AutoGenerateColumns="False" DataKeyNames="classificationid"
> DataSourceID="TopicsSqlDataSource"
> AutoGenerateEditButton="True" BorderColor="#8E7953" BorderWidth="1px"
> Width="209px" EnableViewState="False">
> <Columns>
> <asp:TemplateField HeaderText="Topic"
> SortExpression="description">
> <EditItemTemplate>
> <asp:TextBox ID="TextBox1" runat="server"
> Text='<%# Bind("description") %>' Height="46px" Width="239px"></
> asp:TextBox>
> </EditItemTemplate>
> <ItemTemplate>
> <asp:Label ID="Label1" runat="server" Text='<
> %# Bind("description") %>'></asp:Label>
> </ItemTemplate>
> <ItemStyle BorderColor="#8E7953"
> BorderStyle="Solid" />
> <HeaderStyle BorderColor="#8E7953" Font-
> Bold="True" Font-Size="Large" ForeColor="#006666" />
> </asp:TemplateField>
> <asp:TemplateField HeaderText="Delete Topic"
> InsertVisible="False" SortExpression="classificationid">
> <ItemTemplate>
> <asp:Label ID="classificationid"
> runat="server" Font-Bold="True" Text='<%# DataBinder.Eval
> (Container.DataItem, "classificationID") %>'
> Visible="False"></asp:Label>
> <asp:CheckBox ID="deleteRec" runat="server"
> Font-Bold="True" />
> </ItemTemplate>
> <ItemStyle BorderColor="#8E7953" />
> <HeaderStyle BorderColor="#8E7953" Font-
> Bold="True" Font-Size="Large" ForeColor="#006666" />
> </asp:TemplateField>
> </Columns>
> </asp:GridView>
> <br />
> <br />
> <asp:Button ID="Button3" runat="server" Text="Delete
> Topic" CausesValidation="False" /><br />
> <br />
> <br />
> <strong><span style="font-size: 14pt; color: #006666; font-
> family: Arial; text-decoration: underline">
> </span></strong>
> <br />
> <a href="http://links.10026.com/?link=AddTitle_Description.aspx" id="AddResourceAdminLink"
> runat="server">Add a Resource</a><br />
> <br />
> <a href="http://links.10026.com/?link=EditResoureLibrary.aspx" id="EditResourceAdminLink"
> runat="server">Edit Resource Library Information</a><br />
> <br />
> <br />
> <table>
> <tr>
> <td style="width: 100px">
> <a href="http://links.10026.com/?link=http://philanet/">
> <img alt="PhilaNet" border="0" src="http://pics.10026.com/?src=Images/
> philanet_small.gif" /></a></td>
> <td style="width: 175px">
> <a href="http://links.10026.com/?link=ResourceLibrary.aspx"><strong><span
> style="font-size: 14pt">Resource Library</span></strong></a></td>
> </tr>
> </table>
> <br />
> <asp:SqlDataSource ID="TopicsSqlDataSource"
> runat="server" ConnectionString="<%$
> ConnectionStrings:TrainUserConnectionStr
ing %>"
> SelectCommand="GetClassifications"
> SelectCommandType="StoredProcedure" UpdateCommand="UpdateTopic"
> UpdateCommandType="StoredProcedure">
> <UpdateParameters>
> <asp:Parameter Name="classificationID" Type="Int32" />
> <asp:Parameter Name="description" Type="String" />
> </UpdateParameters>
> </asp:SqlDataSource>
> <br />
> </center>
> </asp:Content>
>
On Nov 13, 4:02 pm, "J055" <j...@.newsgroups.nospam> wrote:
> Checkout the ValidationGroup property.
> "JJ297" <nc...@.yahoo.com> wrote in message
> news:1194986781.386224.323330@.o3g2000hsb.googlegroups.com...
>
>
>
>
> - Show quoted text -
Thanks it worked!

Text Box Loses Value On Page Load

Hi Folks...this is a wierd issue I've noticed and wanted to know of a) anyone
else has noticed this and b) if so, why does it happen.

On page load, I have a text box named me.txtMemberName. I enter data into
this field then submit the page. If I check the value of
me.txtMemberName.text during the page load event, it is an empty string. Now,
if I check this again in a later event, the value of .text has the correct
inforamation in it. This is causing me grief b/c, since this is a required
field, Page.IsValid is failing on page load. Any thoughts?

Thanks!

ClayFirst of all, I am assuming you have EnableViewState=True for this Control,
as well as for the Page. Second, can you post your Page.Load procedure so we
can see exactly what you do there and how you do it? This may help me and
others help you solve your problem. Thanks.
--
Nathan Sokalski
njsokalski@.hotmail.com
http://www.nathansokalski.com/

"Clayton Hoyt" <ClaytonHoyt@.discussions.microsoft.com> wrote in message
news:1D931693-325B-4116-901F-3D09CF24FE8C@.microsoft.com...
> Hi Folks...this is a wierd issue I've noticed and wanted to know of a)
> anyone
> else has noticed this and b) if so, why does it happen.
> On page load, I have a text box named me.txtMemberName. I enter data into
> this field then submit the page. If I check the value of
> me.txtMemberName.text during the page load event, it is an empty string.
> Now,
> if I check this again in a later event, the value of .text has the correct
> inforamation in it. This is causing me grief b/c, since this is a required
> field, Page.IsValid is failing on page load. Any thoughts?
> Thanks!
> Clay

Text box losing most recent Text value

It's me and my registration page again. I have a subroutine that calculates
the total fees the registrant will incur and puts it in a textbox (not a
label because it has to be passed to another page).
txtTotalFees.Text = Format(dblTotalFees, "Currency")
The subroutine works fine IF I call it from PageLoad, or I assign it to a
button for recalculating the total fees, or the user clicks the Reset
button, or if they click a control that has AutoPostback set to true.
Basically anything that loads or postbacks the page.
BUT...When it comes time to submit the page and go to the next page I have
this code:
If IsValid Then
CalcFees() 'recalcs fees and updates textbox
Server.Transfer("Confirmation.aspx", True)
End If
When the user gets to the next page I put the total fees in another textbox.
EXCEPT it isn't updated to most recent total. I know because I can comment
out the "Server.Transfer" so that it stays at the registration page AND THE
CORRECT TOTAL IS DISPLAYED!?!?!
What is it about the Server.Transfer that "forgets" what the value of the
textbox should be?
Ken "BiggMakk" McCroryHi Ken
Try this:
Server.Transfer("Confirmation.aspx", True)
This sets the parameter preserveForm to true, hence preserving any
variables still available.
You can then retrieve the value from your previous page on the
Confirmation.aspx page by using Request.Form("totalFees")
Hope that helps :)
sze
Thanks for the try but I am already using the True to preserve variables.
(See original post. It's there.)
Ken "BiggMakk" McCrory
"sze" <szeying.tan@.gmail.com> wrote in message
news:1110401185.776188.29550@.o13g2000cwo.googlegroups.com...
> Hi Ken
> Try this:
> Server.Transfer("Confirmation.aspx", True)
> This sets the parameter preserveForm to true, hence preserving any
> variables still available.
> You can then retrieve the value from your previous page on the
> Confirmation.aspx page by using Request.Form("totalFees")
> Hope that helps :)
> sze
>
Ah, sorry. I didn't notice it in your code at first glance.
Here's a helpful page from MSDN about preserving state between pages.
http://msdn.microsoft.com/library/d...etweenPages.asp
Hope that helps.
I solved this by using SmartNavigation and turning on Autopostback for every
control that can affect the total fees. Before someone says SmartNav doesn't
work in browsers other than IE, you're right. Someone else in a different
post of mine pointed out Smart Scroller by Strength Technologies at this web
site:
http://www.strengthtechnologies.com...l/Download.aspx
It works even in Firefox.
Now the Total fees gets updated before the user hits the Submit button and
the correct value gets passed to the next page. It also removes the need for
the manual "Recalculate Fees" button that I had on the page.
--
Ken "BiggMakk" McCrory
"Ken McCrory" <klm355t@.removefornospammers.smsu.edu> wrote in message
news:OjfvdfOJFHA.688@.TK2MSFTNGP10.phx.gbl...
> It's me and my registration page again. I have a subroutine that
> calculates the total fees the registrant will incur and puts it in a
> textbox (not a label because it has to be passed to another page).
> txtTotalFees.Text = Format(dblTotalFees, "Currency")
> The subroutine works fine IF I call it from PageLoad, or I assign it to a
> button for recalculating the total fees, or the user clicks the Reset
> button, or if they click a control that has AutoPostback set to true.
> Basically anything that loads or postbacks the page.
> BUT...When it comes time to submit the page and go to the next page I have
> this code:
> If IsValid Then
> CalcFees() 'recalcs fees and updates textbox
> Server.Transfer("Confirmation.aspx", True)
> End If
> When the user gets to the next page I put the total fees in another
> textbox. EXCEPT it isn't updated to most recent total. I know because I
> can comment out the "Server.Transfer" so that it stays at the registration
> page AND THE CORRECT TOTAL IS DISPLAYED!?!?!
> What is it about the Server.Transfer that "forgets" what the value of the
> textbox should be?
> Ken "BiggMakk" McCrory
>
Yeah Ken the control works with FireFox and I.E!!!
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!

Text box losing most recent Text value

It's me and my registration page again. I have a subroutine that calculates
the total fees the registrant will incur and puts it in a textbox (not a
label because it has to be passed to another page).

txtTotalFees.Text = Format(dblTotalFees, "Currency")

The subroutine works fine IF I call it from PageLoad, or I assign it to a
button for recalculating the total fees, or the user clicks the Reset
button, or if they click a control that has AutoPostback set to true.
Basically anything that loads or postbacks the page.

BUT...When it comes time to submit the page and go to the next page I have
this code:

If IsValid Then
CalcFees() 'recalcs fees and updates textbox
Server.Transfer("Confirmation.aspx", True)
End If

When the user gets to the next page I put the total fees in another textbox.
EXCEPT it isn't updated to most recent total. I know because I can comment
out the "Server.Transfer" so that it stays at the registration page AND THE
CORRECT TOTAL IS DISPLAYED!?!?!

What is it about the Server.Transfer that "forgets" what the value of the
textbox should be?

Ken "BiggMakk" McCroryHi Ken

Try this:
Server.Transfer("Confirmation.aspx", True)
This sets the parameter preserveForm to true, hence preserving any
variables still available.

You can then retrieve the value from your previous page on the
Confirmation.aspx page by using Request.Form("totalFees")

Hope that helps :)
sze
Thanks for the try but I am already using the True to preserve variables.
(See original post. It's there.)

Ken "BiggMakk" McCrory

"sze" <szeying.tan@.gmail.com> wrote in message
news:1110401185.776188.29550@.o13g2000cwo.googlegro ups.com...
> Hi Ken
> Try this:
> Server.Transfer("Confirmation.aspx", True)
> This sets the parameter preserveForm to true, hence preserving any
> variables still available.
> You can then retrieve the value from your previous page on the
> Confirmation.aspx page by using Request.Form("totalFees")
> Hope that helps :)
> sze
Ah, sorry. I didn't notice it in your code at first glance.

Here's a helpful page from MSDN about preserving state between pages.
http://msdn.microsoft.com/library/d...etweenPages.asp

Hope that helps.
I solved this by using SmartNavigation and turning on Autopostback for every
control that can affect the total fees. Before someone says SmartNav doesn't
work in browsers other than IE, you're right. Someone else in a different
post of mine pointed out Smart Scroller by Strength Technologies at this web
site:

http://www.strengthtechnologies.com...l/Download.aspx

It works even in Firefox.

Now the Total fees gets updated before the user hits the Submit button and
the correct value gets passed to the next page. It also removes the need for
the manual "Recalculate Fees" button that I had on the page.
--
Ken "BiggMakk" McCrory

"Ken McCrory" <klm355t@.removefornospammers.smsu.edu> wrote in message
news:OjfvdfOJFHA.688@.TK2MSFTNGP10.phx.gbl...
> It's me and my registration page again. I have a subroutine that
> calculates the total fees the registrant will incur and puts it in a
> textbox (not a label because it has to be passed to another page).
> txtTotalFees.Text = Format(dblTotalFees, "Currency")
> The subroutine works fine IF I call it from PageLoad, or I assign it to a
> button for recalculating the total fees, or the user clicks the Reset
> button, or if they click a control that has AutoPostback set to true.
> Basically anything that loads or postbacks the page.
> BUT...When it comes time to submit the page and go to the next page I have
> this code:
> If IsValid Then
> CalcFees() 'recalcs fees and updates textbox
> Server.Transfer("Confirmation.aspx", True)
> End If
> When the user gets to the next page I put the total fees in another
> textbox. EXCEPT it isn't updated to most recent total. I know because I
> can comment out the "Server.Transfer" so that it stays at the registration
> page AND THE CORRECT TOTAL IS DISPLAYED!?!?!
> What is it about the Server.Transfer that "forgets" what the value of the
> textbox should be?
> Ken "BiggMakk" McCrory
Yeah Ken the control works with FireFox and I.E!!!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Text Box Loses Value On Page Load

Hi Folks...this is a wierd issue I've noticed and wanted to know of a) anyon
e
else has noticed this and b) if so, why does it happen.
On page load, I have a text box named me.txtMemberName. I enter data into
this field then submit the page. If I check the value of
me.txtMemberName.text during the page load event, it is an empty string. Now
,
if I check this again in a later event, the value of .text has the correct
inforamation in it. This is causing me grief b/c, since this is a required
field, Page.IsValid is failing on page load. Any thoughts?
Thanks!
ClayFirst of all, I am assuming you have EnableViewState=True for this Control,
as well as for the Page. Second, can you post your Page.Load procedure so we
can see exactly what you do there and how you do it? This may help me and
others help you solve your problem. Thanks.
--
Nathan Sokalski
njsokalski@.hotmail.com
http://www.nathansokalski.com/
"Clayton Hoyt" <ClaytonHoyt@.discussions.microsoft.com> wrote in message
news:1D931693-325B-4116-901F-3D09CF24FE8C@.microsoft.com...
> Hi Folks...this is a wierd issue I've noticed and wanted to know of a)
> anyone
> else has noticed this and b) if so, why does it happen.
> On page load, I have a text box named me.txtMemberName. I enter data into
> this field then submit the page. If I check the value of
> me.txtMemberName.text during the page load event, it is an empty string.
> Now,
> if I check this again in a later event, the value of .text has the correct
> inforamation in it. This is causing me grief b/c, since this is a required
> field, Page.IsValid is failing on page load. Any thoughts?
> Thanks!
> Clay

Text Box Problem

Hello,
I have a master page where my form has the Runat="server".
The master page as a control place holder, named "cphContent".
Then in a page which inherits from the master page I added a custom
control which I created.
This custom control is added to "cphContent" at runtime.
The custom control creates and adds 2 textboxes using
CreateChildControls.
I am getting an error:
System.Web.HttpException: Control 'ctl00_cphContent_by27cf_tbName' of
type 'TextBox' must be placed inside a form tag with runat=server.
I have no idea why do I get this error.
The form with Runat="server" is in the master page.
Anyway, can someone tell me how can I figure what is going on?
Thanks,
MiguelHere is my code.
I am adding and creating all controls at runtime in my pages.
---
Base.master:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="fBase" runat="server"></form>
</body>
</html>
Base.master.vb:
Protected Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs)
Handles Me.Init
Dim pContainer As New Panel
AddHandler pContainer.Init, AddressOf pContainer_Init
Me.Controls.Add(pContainer)
Dim cphContent As New ContentPlaceHolder
AddHandler cphContent.Init, AddressOf cphContent_Init
pContent.Controls.Add(cphContent)
End Sub
MyPage.aspx:
<%@. Page Language="VB" CodeFile="Default.aspx.vb" Inherits="_Default"
%>
MyPage.aspx.vb:
Protected Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs)
Handles Me.Init
Dim by27fContactForm As New By27.Web.UI.Form.Contact
AddHandler by27fContactForm.Init, AddressOf by27fContactForm_Init
pContacts.Controls.Add(by27fContactForm)
End Sub
Class Contact in Namespace By27.Web.UI:
Namespace Web.UI.Form
' Content
<DefaultProperty("Text"), ToolboxData("<{0}:ContactForm
runat=server></{0}:ContactForm>")> _
Public Class Contact
Inherits WebControl
Dim by27cf_tbName As New WebControls.TextBox
Private Sub by27cf_tbName_Init(ByVal sender As Object, ByVal e As
System.EventArgs)
With by27cf_tbName
.CssClass = Me.TextBoxCssClass
.ID = "by27cf_tbName"
.Width = Unit.Percentage(100)
End With
End Sub
<Bindable(True), Category("Appearance"), DefaultValue(""),
Localizable(True)> Property TextBoxCssClass() As String
Get
If CStr(ViewState("TextBoxCssClass")) Is Nothing Then
Return String.Empty
Else
Return CStr(ViewState("TextBoxCssClass"))
End If
End Get
Set(ByVal Value As String)
ViewState("TextBoxCssClass") = Value
End Set
End Property
Protected Overrides Sub CreateChildControls()
AddHandler by27cf_tbName.Init, AddressOf by27cf_tbName_Init
MyBase.Controls.Add(by27cf_tbName)
' Create child controls
MyBase.CreateChildControls()
Me.ChildControlsCreated = True
End Sub
End Class
---
Thanks,
Miguel
shapper wrote:
> Hello,
> I have a master page where my form has the Runat="server".
> The master page as a control place holder, named "cphContent".
> Then in a page which inherits from the master page I added a custom
> control which I created.
> This custom control is added to "cphContent" at runtime.
> The custom control creates and adds 2 textboxes using
> CreateChildControls.
> I am getting an error:
> System.Web.HttpException: Control 'ctl00_cphContent_by27cf_tbName' of
> type 'TextBox' must be placed inside a form tag with runat=server.
> I have no idea why do I get this error.
> The form with Runat="server" is in the master page.
> Anyway, can someone tell me how can I figure what is going on?
> Thanks,
> Miguel
This is a bug of Visual Studio. A problem is that in content page you don't
have form
"shapper" <mdmoura@.gmail.com> wrote in message
news:1163016480.466822.19390@.m7g2000cwm.googlegroups.com...
> Hello,
> I have a master page where my form has the Runat="server".
> The master page as a control place holder, named "cphContent".
> Then in a page which inherits from the master page I added a custom
> control which I created.
> This custom control is added to "cphContent" at runtime.
> The custom control creates and adds 2 textboxes using
> CreateChildControls.
> I am getting an error:
> System.Web.HttpException: Control 'ctl00_cphContent_by27cf_tbName' of
> type 'TextBox' must be placed inside a form tag with runat=server.
> I have no idea why do I get this error.
> The form with Runat="server" is in the master page.
> Anyway, can someone tell me how can I figure what is going on?
> Thanks,
> Miguel
>

Text Box Problem

Hello,

I have a master page where my form has the Runat="server".
The master page as a control place holder, named "cphContent".
Then in a page which inherits from the master page I added a custom
control which I created.
This custom control is added to "cphContent" at runtime.
The custom control creates and adds 2 textboxes using
CreateChildControls.

I am getting an error:
System.Web.HttpException: Control 'ctl00_cphContent_by27cf_tbName' of
type 'TextBox' must be placed inside a form tag with runat=server.

I have no idea why do I get this error.
The form with Runat="server" is in the master page.

Anyway, can someone tell me how can I figure what is going on?

Thanks,
MiguelHere is my code.

I am adding and creating all controls at runtime in my pages.

----------------------

Base.master:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="fBase" runat="server"></form>
</body>
</html>

Base.master.vb:

Protected Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs)
Handles Me.Init

Dim pContainer As New Panel
AddHandler pContainer.Init, AddressOf pContainer_Init
Me.Controls.Add(pContainer)

Dim cphContent As New ContentPlaceHolder
AddHandler cphContent.Init, AddressOf cphContent_Init
pContent.Controls.Add(cphContent)

End Sub

MyPage.aspx:

<%@. Page Language="VB" CodeFile="Default.aspx.vb" Inherits="_Default"
%>

MyPage.aspx.vb:

Protected Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs)
Handles Me.Init

Dim by27fContactForm As New By27.Web.UI.Form.Contact
AddHandler by27fContactForm.Init, AddressOf by27fContactForm_Init
pContacts.Controls.Add(by27fContactForm)

End Sub

Class Contact in Namespace By27.Web.UI:

Namespace Web.UI.Form

' Content
<DefaultProperty("Text"), ToolboxData("<{0}:ContactForm
runat=server></{0}:ContactForm>")_
Public Class Contact
Inherits WebControl

Dim by27cf_tbName As New WebControls.TextBox
Private Sub by27cf_tbName_Init(ByVal sender As Object, ByVal e As
System.EventArgs)
With by27cf_tbName
.CssClass = Me.TextBoxCssClass
.ID = "by27cf_tbName"
.Width = Unit.Percentage(100)
End With
End Sub

<Bindable(True), Category("Appearance"), DefaultValue(""),
Localizable(True)Property TextBoxCssClass() As String
Get
If CStr(ViewState("TextBoxCssClass")) Is Nothing Then
Return String.Empty
Else
Return CStr(ViewState("TextBoxCssClass"))
End If
End Get
Set(ByVal Value As String)
ViewState("TextBoxCssClass") = Value
End Set
End Property

Protected Overrides Sub CreateChildControls()
AddHandler by27cf_tbName.Init, AddressOf by27cf_tbName_Init
MyBase.Controls.Add(by27cf_tbName)
' Create child controls
MyBase.CreateChildControls()
Me.ChildControlsCreated = True
End Sub

End Class

----------------------

Thanks,

Miguel

shapper wrote:

Quote:

Originally Posted by

Hello,
>
I have a master page where my form has the Runat="server".
The master page as a control place holder, named "cphContent".
Then in a page which inherits from the master page I added a custom
control which I created.
This custom control is added to "cphContent" at runtime.
The custom control creates and adds 2 textboxes using
CreateChildControls.
>
I am getting an error:
System.Web.HttpException: Control 'ctl00_cphContent_by27cf_tbName' of
type 'TextBox' must be placed inside a form tag with runat=server.
>
I have no idea why do I get this error.
The form with Runat="server" is in the master page.
>
Anyway, can someone tell me how can I figure what is going on?
>
Thanks,
Miguel


This is a bug of Visual Studio. A problem is that in content page you don't
have form

"shapper" <mdmoura@.gmail.comwrote in message
news:1163016480.466822.19390@.m7g2000cwm.googlegrou ps.com...

Quote:

Originally Posted by

Hello,
>
I have a master page where my form has the Runat="server".
The master page as a control place holder, named "cphContent".
Then in a page which inherits from the master page I added a custom
control which I created.
This custom control is added to "cphContent" at runtime.
The custom control creates and adds 2 textboxes using
CreateChildControls.
>
I am getting an error:
System.Web.HttpException: Control 'ctl00_cphContent_by27cf_tbName' of
type 'TextBox' must be placed inside a form tag with runat=server.
>
I have no idea why do I get this error.
The form with Runat="server" is in the master page.
>
Anyway, can someone tell me how can I figure what is going on?
>
Thanks,
Miguel
>
>

Text Box Problem

Hello,

I have a master page where my form has the Runat="server".
The master page as a control place holder, named "cphContent".
Then in a page which inherits from the master page I added a custom control which I created.
This custom control is added to "cphContent" at runtime.
The custom control creates and adds 2 textboxes using CreateChildControls.

I am getting an error:
System.Web.HttpException: Control 'ctl00_cphContent_by27cf_tbName' of type 'TextBox' must be placed inside a form tag with runat=server.

I have no idea why do I get this error.
The form with Runat="server" is in the master page.

Anyway, can someone tell me how can I figure what is going on?

Thanks,
MiguelYou may need to show some code of how do you set up the Content page.

Here is my code.

I am adding and creating all controls at runtime in my pages.

----------------------

Base.master:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="fBase" runat="server"></form>
</body>
</html
Base.master.vb:

Protected Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Init

Dim pContainer As New Panel
AddHandler pContainer.Init, AddressOf pContainer_Init
Me.Controls.Add(pContainer)

Dim cphContent As New ContentPlaceHolder
AddHandler cphContent.Init, AddressOf cphContent_Init
pContent.Controls.Add(cphContent)

End Sub

MyPage.aspx:

<%@. Page Language="VB" CodeFile="Default.aspx.vb" Inherits="_Default" %>

MyPage.aspx.vb:

Protected Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Init

Dim by27fContactForm As New By27.Web.UI.Form.Contact
AddHandler by27fContactForm.Init, AddressOf by27fContactForm_Init
pContacts.Controls.Add(by27fContactForm)

End Sub

Class Contact in Namespace By27.Web.UI:

Namespace Web.UI.Form

' Content
<DefaultProperty("Text"), ToolboxData("<{0}:ContactForm runat=server></{0}:ContactForm>")> _
Public Class Contact
Inherits WebControl

Dim by27cf_tbName As New WebControls.TextBox
Private Sub by27cf_tbName_Init(ByVal sender As Object, ByVal e As System.EventArgs)
With by27cf_tbName
.CssClass = Me.TextBoxCssClass
.ID = "by27cf_tbName"
.Width = Unit.Percentage(100)
End With
End Sub

<Bindable(True), Category("Appearance"), DefaultValue(""), Localizable(True)> Property TextBoxCssClass() As String
Get
If CStr(ViewState("TextBoxCssClass")) Is Nothing Then
Return String.Empty
Else
Return CStr(ViewState("TextBoxCssClass"))
End If
End Get
Set(ByVal Value As String)
ViewState("TextBoxCssClass") = Value
End Set
End Property

Protected Overrides Sub CreateChildControls()
AddHandler by27cf_tbName.Init, AddressOf by27cf_tbName_Init
MyBase.Controls.Add(by27cf_tbName)
' Create child controls
MyBase.CreateChildControls()
Me.ChildControlsCreated = True
End Sub

End Class

----------------------

Thanks,

Miguel


The controls are not being added between the form tags. Add a placeholder to the masterpage and add your controls (panel/contentholder) to that, instead of the page.

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="fBase" runat="server">
<asp:PlaceHolder id="ControlHolder" runat="server"/>
</form>
</body>
</html>


In this line

pContent.Controls.Add(cphContent)

What and/or where is "pContent"? It isn't entirely clear where you're getting it from.


It should be pContainer and not pContent.

It was a mistake when coping it to here. I just copied parts of the code to give an idea


shapper:

Base.master:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="fBase" runat="server"></form>
</body>
</html
Base.master.vb:

Protected Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Init

Dim pContainer As New Panel
AddHandler pContainer.Init, AddressOf pContainer_Init
Me.Controls.Add(pContainer)

Dim cphContent As New ContentPlaceHolder
AddHandler cphContent.Init, AddressOf cphContent_Init
pContent.Controls.Add(cphContent)

End Sub

In the Page_Init above, you are adding a Panel to thepage, but not to theform. Therefore, cphContent is not in the form. And when you add the custom control to cphContent, then obviously that's not in the form either.

Text box reading old value

Hi i am trying to create a simple page that would allow users to edit there infromation that is stored on them,

It loads the information from the database fine and puts it into the textbox's but then on the "update" button it doesnt get the changed values

e.g

if the textbox was set on the page load to "bren" and then i changed it on the page to be "Hello" when i execute the onlclick function of the button it still reads as "bren"

using System;using System.Data;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using System.Data.Odbc;public partialclass user_userDetails : System.Web.UI.Page{protected void Page_Load(object sender, EventArgs e) {if (!HttpContext.Current.User.Identity.Name.Contains(ConfigurationManager.AppSettings["siteGSTPrefix"])) {string userGuid = HttpContext.Current.User.Identity.Name; OdbcConnection detailsCon = sqlconnect.Connect(); OdbcCommand detailsCom =new OdbcCommand("SELECT tbl_usr.Username,tbl_usr_info.first_name,tbl_usr_info.second_name,tbl_usr_info.address_line_1,tbl_usr_info.address_line_2,tbl_usr_info.address_line_3,tbl_usr_info.post_code,tbl_usr_info.home_phone,tbl_usr_info.work_phone,tbl_usr_info.email_addy FROM tbl_usr INNER JOIN tbl_usr_info ON tbl_usr.usr_guid = tbl_usr_info.usr_guid WHERE tbl_usr.usr_guid='" + userGuid +"'", detailsCon); OdbcDataReader detRead = detailsCom.ExecuteReader();while (detRead.Read()) { userNote.Text ="Your Password is not displayed for security!"; userName.Text = detRead["Username"].ToString().Replace("#@dotnet.itags.org.","'"); fName.Text = detRead["first_name"].ToString().Replace("#@dotnet.itags.org.","'"); sName.Text = detRead["second_name"].ToString().Replace("#@dotnet.itags.org.","'"); aD1.Text = detRead["address_line_1"].ToString().Replace("#@dotnet.itags.org.","'"); aD2.Text = detRead["address_line_2"].ToString().Replace("#@dotnet.itags.org.","'"); aD3.Text = detRead["address_line_3"].ToString().Replace("#@dotnet.itags.org.","'"); pCode.Text = detRead["post_code"].ToString().Replace("#@dotnet.itags.org.","'"); hPhone.Text = detRead["home_phone"].ToString().Replace("#@dotnet.itags.org.","'"); wPhone.Text = detRead["work_phone"].ToString().Replace("#@dotnet.itags.org.","'"); eAddy.Text = detRead["email_addy"].ToString().Replace("#@dotnet.itags.org.","'"); } detRead.Close(); detailsCon.Close(); }else { Response.Redirect(FormsAuthentication.LoginUrl); } }protected void update_click(object sender, EventArgs e) {string userGuid = HttpContext.Current.User.Identity.Name;string passSettings =string.Empty; Response.Clear();if(userPass.Text.ToString() !="" && userPass.Text.ToString() !=null) { passSettings =" , tbl_usr.Password = '" + userPass.Text.ToString().Replace("'","#@dotnet.itags.org.") +"'"; } OdbcConnection detCon = sqlconnect.Connect(); OdbcCommand upCom =new OdbcCommand("UPDATE tbl_usr SET tbl_usr.Username = '" + userName.Text.ToString().Replace("'","#@dotnet.itags.org.") +"' " + passSettings +" WHERE tbl_usr.usr_guid = '" + userGuid +"'", detCon); upCom.ExecuteNonQuery(); OdbcCommand upComInfo =new OdbcCommand("UPDATE tbl_usr_info SET tbl_usr_info.first_name = '" + fName.Text.Replace("'","#@dotnet.itags.org.") +"' , tbl_usr_info.second_name = '" + sName.Text.Replace("'","#@dotnet.itags.org.").Trim() +"' , tbl_usr_info.address_line_1 = '" + aD1.Text.ToString().Replace("'","#@dotnet.itags.org.") +"' , tbl_usr_info.address_line_2 = '" + aD2.Text.ToString().Replace("'","#@dotnet.itags.org.") +"' , tbl_usr_info.address_line_3 = '" + aD3.Text.ToString().Replace("'","#@dotnet.itags.org.") +"' , tbl_usr_info.post_code = '" + pCode.Text.ToString().Replace("'","#@dotnet.itags.org.") +"' , tbl_usr_info.work_phone = '" + wPhone.Text.ToString().Replace("'","#@dotnet.itags.org.") +"' , tbl_usr_info.home_phone = '" + hPhone.Text.ToString().Replace("'","#@dotnet.itags.org.") +"' , tbl_usr_info.email_addy = '" + eAddy.Text.ToString().Replace("'","#@dotnet.itags.org.") +"' WHERE tbl_usr_info.usr_guid = '" + userGuid +"'", detCon); upComInfo.ExecuteNonQuery(); userNote.Text ="Your details have been updated"; }}


Thanks for your help in advance

Dan

your update_click is happening after the page_load. try changing the code you have in page_load to page_prerender and see if you are good to go.


i have treid to user it with IsPostBack but it doesnt work,

i didnt think that Page_load was re run when u clicked on a button and ran the function

Dan


Fixed it now thanks changed it to a !IsPostBack and it now works thanks

text box text wont change

i have a asp.net page that has some text boxes with some text in there..then i have a submit button..the problem is that when i try in code to get what the textboxes have in the .Text property i get what i've put when the page loaded and not what actually the user has written! anyone has experienced this? what am i doing wrong? :confused:

help!!!!!!!!!!!!!You just not checking for post back...like I said in the other thread, post your code (especially your load event code) and I will show you how to use it properly to ensure things like this don't happen.
load event
WebMessage web = Serializer.BinDeSerializer(Server.MapPath(@."Logs\" + Request.QueryString["File"]));
msgTxt.Text = web.Message;
titleTxt.Text = web.Title;
nickTxt.Text = web.Author;
post(edit)button
case "EDIT": {
Debug.WriteLine(titleTxt.Text);
string filename = Server.MapPath(@."Logs\" + Request.QueryString["File"]);
WebMessage oldMsg = Serializer.BinDeSerializer(filename);

if (File.Exists(filename)) {
File.Delete(filename);
}

WebMessage newMsg = new WebMessage(
titleTxt.Text,
msgTxt.Text,
nickTxt.Text,
DateTime.Now,
oldMsg.Comments,
Path.GetFileName(filename));

Serializer.BinSerialize(newMsg, filename);
Response.Redirect("Log.aspx?&Action=POST", true);
break;
where titleTxt,msgTxt,nickTxt are the TextBoxes which arent changing the text
In your page load event, check for Page.IsPostBack.

if (!Page.IsPostBack) {
// Perform your initialization (db calls, etc..)
}
still not working...i dont get what would help checkin if it is postback or not lol..because if it is postback and now is not working then checking for it wont help, if it isnt and isnt working by checking i will not do it work..so *** can i do?
Because we are working in a stateless environment. Everytime a postback occurs, the page_load event fires off before any of the control event(s) that caused the post back. So, if you reset the values in the load event, then in your event handler, you are still dealing with the initial default values.
Change to this:

if (!Page.IsPostBack)
{
WebMessage web = Serializer.BinDeSerializer(Server.MapPath(@."Logs\" + Request.QueryString["File"]));
msgTxt.Text = web.Message;
titleTxt.Text = web.Title;
nickTxt.Text = web.Author;
}
hmm...even with hellswraith code it doesnt work..
Well, the code I posted is the exact same, so it wouldn't work (minus the three lines of code) :rolleyes:

Post your entire code-behind, it's something else..
hmm my page is getting a bit confusing, since its only my 2nd asp.net project and i wasnt expecting for somethings i had to implement..i will make a new architecture for the site and then i will try again and if it doesnt work post it here again..but i need to implement cookies..anyone could answer by other post about cookies plz? :D

tks by ur answers btw

Text Box to a Database to a Label

Hi

Im fairly new to ASP.NET, im using 2.0.

I am trying to develop a page where the user can enter text into a multiline textbox and then when they click enter the text is stored in a Table in an SQLServer DB.

When the page is reloaded the text that was stored is outputed to a Label.

This works ok except for one small problem when I entertext in the text box which is more than one line IE

"Hello
my
name
is
Graham"

It is displayed in the Label as "Hello my name is Graham"

Does anyone know how to keep the text in the form that it was entered in the textboxwhen it is displayed in the Label?

Other wise I will not be able to have paragraghs etc, just one long string.

Thanks Graham

The text entered in the multiline textbox has crlf (Carriage Return Line Feed) for line breaks. When you display in html, you must replace those with <br /> to achieve the similar layout.

Hope it helps,

Joe

Text box values are not being considered?

Currently i m working on a web page that edits the user information. The already stored info. from the database is being displayed in diffrent text boxes so that user can edit it. The problem is that even when user changes the information in the any of the text-boxes & clicks the submit button, then instead of current value of text-boxes the previously assigned value is being considered. Whats the possible cause of this error?

Possibly... your records arent getting updated


bh_84:

Currently i m working on a web page that edits the user information. The already stored info. from the database is being displayed in diffrent text boxes so that user can edit it. The problem is that even when user changes the information in the any of the text-boxes & clicks the submit button, then instead of current value of text-boxes the previously assigned value is being considered. Whats the possible cause of this error?

Are they data bound controls? That could be your problem. Since the page load method will run before the click handler, if those databound controls are populated on every post back, they are likely being overwritten there. You will need to only data bind the text boxes when the page isn't posting back.


No they r simple text box controls. values are being assigned to them using text property & not through data binding but still on submiting, the not the current values but the previous ones are being considered.

Doesn't matter if you are databinding or assigning the values yourself. Probably what is happening is the user changes the value and then hits submit to post back the page. At that point your code is setting the Text property for these text values to whatever the initial value is just like it does when you first load the page and is overwriting whatever change the user made. You are probably always setting the values even on postback so you never get the values the user specifies. In your code you need to only set the values if it is not a postback. So something like:

If (!IsPostBack)

{

// Set all textboxes to initial values here.

}

That is C# so if you're using VB you'll need to do the similar thing in VB. This will make sure that when the page is posted back the textboxes don't get overwritten witih the initial values and have whatever values were entered at the browser.

Wednesday, March 28, 2012

Text Box Will Not Wrap Text

VWD 2005 Express. Visual Basic. I placed a text box control on my page. I set the wrap property to true. I assign a value to the text property from code behind. The text does not wrap, but instead disappears when it hits the right margin. The only way I seem to be able to get it to wrap is to set the text box control to "multiline." However, this puts up a scroll bar, which I do not want. I want the box to be single line and to wrap. What might I be doing wrong?

you cant wrap the text unless it's multiline...

You can (I think) remove the scrollbars though, but it will need to be multiline


You need multiline...

What exactly are you trying to do? Have you considered a listbox? How about a dropdownlist box?


Turns out that a label control served me better. Thanks.

Text boxes in web pages

Am I the only person in the world or are there others that experience this problem.

When programming a web page, I create a table with text boxes in it. The background color of the boxes change to a yellow colr when the app is run.

I have even tried resetting the color in code but it still changes to yellow.

This has happened in several versions of VB .net that I have used.

Any solutions would be greatly appretiated as I have tried all that I know.

PeterGThread Moved
It's not ASP.NET - it's the Google toolbar, or any other autocomplete toolbar, you have installed.
Yes, that is true. I just learned of this in another thread a few hours ago thanks to timeshifter.

Uninstall the google toolbar.

Text boxes and read-only text

I'm wondering what standard/best practices are for the following scenario:
I have a page representing several fields for stored data. If the user has
sufficient access privileges, the page is rendered w/ read/write text boxes
and
they can edit the various fields as needed. However, if the user doesn't ha
ve
sufficient privileges (i.e. view only), the page is rendered w/ the text box
es
set to read-only. However, this results in a rather clunky looking page, an
d
if there is more text in a box than can be rendered w/i the specified box
height, then the user must scroll. Further, when printing the page, the tex
t
is clipped to the box.
So, my thought has been to re-design the page to use two different controls
for
each text field: a text box for read/write, and a label (static text) for
read-only. My thought that it will result in a much cleaner view page, and
printing will be as expected. The negative is that there are then two contr
ols
for each field, and I must hide/show the appropriate control depending on th
e
read-write/read-only status.
Is there a better way to do this that doesn't rely on two controls for each
control?
Thanks for any thoughts and insights.What is your browser base?
If you know that it is IE only..
check out contenteditable... basically it allows any html element to be
editable..
http://msdn.microsoft.com/library/d...enteditable.asp
so you could do
<div contenteditable="true">This text it editable</div>
for those that have read write..
then simply change the flag to false if it is readonly,
This means printing doesnt get cliped either.
To make it so that you can still reference input ins your code you can do
<div contenteditable="true" id="Body" onpropertychange="BodyInput.value =
this.innerText;">This text it editable</div>
<input type="hidden" name="BodyInput" value="">
then you simple get the data from the this.BodyInput.value property on the
server.
Not sure if this is what you are after but it may give you ideas as to where
to go from here.
"Julie" <julie@.nospam.com> wrote in message
news:40A1967F.D6ACF7C2@.nospam.com...
> I'm wondering what standard/best practices are for the following scenario:
> I have a page representing several fields for stored data. If the user
has
> sufficient access privileges, the page is rendered w/ read/write text
boxes and
> they can edit the various fields as needed. However, if the user doesn't
have
> sufficient privileges (i.e. view only), the page is rendered w/ the text
boxes
> set to read-only. However, this results in a rather clunky looking page,
and
> if there is more text in a box than can be rendered w/i the specified box
> height, then the user must scroll. Further, when printing the page, the
text
> is clipped to the box.
> So, my thought has been to re-design the page to use two different
controls for
> each text field: a text box for read/write, and a label (static text) for
> read-only. My thought that it will result in a much cleaner view page,
and
> printing will be as expected. The negative is that there are then two
controls
> for each field, and I must hide/show the appropriate control depending on
the
> read-write/read-only status.
> Is there a better way to do this that doesn't rely on two controls for
each
> control?
> Thanks for any thoughts and insights.
Darren Clark wrote:
> What is your browser base?
> If you know that it is IE only..
> check out contenteditable... basically it allows any html element to be
> editable..
> http://msdn.microsoft.com/library/d...enteditable.asp
> so you could do
> <div contenteditable="true">This text it editable</div>
> for those that have read write..
> then simply change the flag to false if it is readonly,
> This means printing doesnt get cliped either.
> To make it so that you can still reference input ins your code you can do
> <div contenteditable="true" id="Body" onpropertychange="BodyInput.value =
> this.innerText;">This text it editable</div>
> <input type="hidden" name="BodyInput" value="">
> then you simple get the data from the this.BodyInput.value property on the
> server.
> Not sure if this is what you are after but it may give you ideas as to whe
re
> to go from here.
Thanks for the link and info, I'll look into it.
And, yes, my target is IE.

Text boxes and read-only text

I'm wondering what standard/best practices are for the following scenario:

I have a page representing several fields for stored data. If the user has
sufficient access privileges, the page is rendered w/ read/write text boxes and
they can edit the various fields as needed. However, if the user doesn't have
sufficient privileges (i.e. view only), the page is rendered w/ the text boxes
set to read-only. However, this results in a rather clunky looking page, and
if there is more text in a box than can be rendered w/i the specified box
height, then the user must scroll. Further, when printing the page, the text
is clipped to the box.

So, my thought has been to re-design the page to use two different controls for
each text field: a text box for read/write, and a label (static text) for
read-only. My thought that it will result in a much cleaner view page, and
printing will be as expected. The negative is that there are then two controls
for each field, and I must hide/show the appropriate control depending on the
read-write/read-only status.

Is there a better way to do this that doesn't rely on two controls for each
control?

Thanks for any thoughts and insights.What is your browser base?

If you know that it is IE only..

check out contenteditable... basically it allows any html element to be
editable..
http://msdn.microsoft.com/library/d...enteditable.asp

so you could do
<div contenteditable="true">This text it editable</div>
for those that have read write..
then simply change the flag to false if it is readonly,

This means printing doesnt get cliped either.

To make it so that you can still reference input ins your code you can do

<div contenteditable="true" id="Body" onpropertychange="BodyInput.value =
this.innerText;">This text it editable</div>
<input type="hidden" name="BodyInput" value=""
then you simple get the data from the this.BodyInput.value property on the
server.

Not sure if this is what you are after but it may give you ideas as to where
to go from here.

"Julie" <julie@.nospam.com> wrote in message
news:40A1967F.D6ACF7C2@.nospam.com...
> I'm wondering what standard/best practices are for the following scenario:
> I have a page representing several fields for stored data. If the user
has
> sufficient access privileges, the page is rendered w/ read/write text
boxes and
> they can edit the various fields as needed. However, if the user doesn't
have
> sufficient privileges (i.e. view only), the page is rendered w/ the text
boxes
> set to read-only. However, this results in a rather clunky looking page,
and
> if there is more text in a box than can be rendered w/i the specified box
> height, then the user must scroll. Further, when printing the page, the
text
> is clipped to the box.
> So, my thought has been to re-design the page to use two different
controls for
> each text field: a text box for read/write, and a label (static text) for
> read-only. My thought that it will result in a much cleaner view page,
and
> printing will be as expected. The negative is that there are then two
controls
> for each field, and I must hide/show the appropriate control depending on
the
> read-write/read-only status.
> Is there a better way to do this that doesn't rely on two controls for
each
> control?
> Thanks for any thoughts and insights.
Darren Clark wrote:
> What is your browser base?
> If you know that it is IE only..
> check out contenteditable... basically it allows any html element to be
> editable..
> http://msdn.microsoft.com/library/d...enteditable.asp
> so you could do
> <div contenteditable="true">This text it editable</div>
> for those that have read write..
> then simply change the flag to false if it is readonly,
> This means printing doesnt get cliped either.
> To make it so that you can still reference input ins your code you can do
> <div contenteditable="true" id="Body" onpropertychange="BodyInput.value =
> this.innerText;">This text it editable</div>
> <input type="hidden" name="BodyInput" value="">
> then you simple get the data from the this.BodyInput.value property on the
> server.
> Not sure if this is what you are after but it may give you ideas as to where
> to go from here.

Thanks for the link and info, I'll look into it.

And, yes, my target is IE.