Saturday, March 31, 2012

TExt Box :-( image

Dear Advance,

How to save image from a given textbox text.

Regards,

Kamrul Hassan

huh?

You can't... if you want the client to upload an image use the upload control.... you can't pull a file off the client PC...thank heaven...

Text box

Hello can anybody write me how to clear text from texbox after I click on button

Hi

on Button's Click event (after you've read the Text) set

[VB]
TextBox1.Text = ""

[C#]
TextBox1.Text = "";

assuming your TextBox's ID isTextBox1


Use something like this in the click event handler of the button:

TextBox1.Text = "";

(where TextBox1 is the ID of your text box)

Regards,
Martin


This method: TextBox1.Text = ""; is not fast, because you make request on server ,optimal use JavaScript on ClientMachine:function f(){tbx.value="";}

Text Box

Hi,

I have an update button click event like this :

lblmessage.text = txtAuthor.text;

Even though I manually change the data in text box, somehow it does not show on to the label field.Whatever value I put in txtAuthor the label field is empty.

Any help is greatly appreciated. I hope I have framed my question properly.

With the semi-colon after the line, it looks like C#, so, just in case - what language are you using (VB or C#)?

augustwind:

With the semi-colon after the line, it looks like C#, so, just in case - what language are you using (VB or C#)?

I am using C#. Actually the updated data from the textbox goes to the property of an object. But when I found there was a problem I created a label control to see if the data is being read from the text box. But no data is being read from the text box.


Well - I don't really know what to tell you - it definitely should work.

Save it again - and rebuild - then run it, and put a break point at the code line and see if it ever hits that line.


Are u changing the value of the textbox in the page load, because that event is fired first.

Hope this helps

Thanks

Vikram

Vikram's Blog


Are you using Visual Web Developer? I have the same problem sometime when trying to get the values for update/.

Thanks


e_screw:

Are you using Visual Web Developer? I have the same problem sometime when trying to get the values for update/.

Thanks

I am using the Full blown edition of VS. I guess as Vikram suggested I am gonna have to check the code in the page load event.


Thanks a lot for the reply guys. I was able to fix the problem.

The problem was that I was pulling the data from the database in the page load event. And whenever I click the update button the original data from teh DB get loaded due to the page load event firing first. So there was no update taking place. Hence the label control which was pulling the data from the textbox was pulling the original data instead of the updated data... I hope I make sense in what I said.

I fixed it by adding the code for pulling data from the DB inside the " if (! IsPostBack) { } " block within the page load event. That fixed the problem in the test page that I created. I havent yet tested it on other pages that I am having trouble with. Hope fully I have resolved the problem. Thanks to Vikram for pointing out the Page Load event.

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
>