Showing posts with label submit. Show all posts
Showing posts with label submit. 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 and submit button not visible on the browser

Hi,
I am new to this group and to ASP.Net. I wrote a simple .aspx program in VS.Net environment. It has a label control, TextBox control and a button control. When the page is viewed on the browser, one enters their name or whatever and click the submit button, the resulting page shoul display "Hello and the text from the text box. I added required code in the button click event. The problem is when the page is loaded first time on the browser, I see only the label contol with the text that I entered before. Text Box and the Button controls are not visible. Any clues??
thanks.do you have runat=server for both?
Make sure that you have runat="server" in the html for the textbox and button...and make sure you have not set the visible property to false

MajorCats
I do have runat="server" and the Visible properties are set to False. Still it is not working. any other clues?...
After playing around with the code, I realized that none of my web controls are visible in the browser. If I change the following code
<asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
to
<input type="text" id="TextBox1"> </input>
then, I see the text box.
But it is not useful when I am trying to build a page using the web controls.
Why is it none of my web controls are visible?.
Anyone know what is triggering this kind of behavior?
help please...... :(
..."and the Visible properties are set to False."

I am assuming you meant that the visible property is NOT set to false...or this is your problem.

Post your html and code...

MajorCats
Here is the code... None of my web controls are visible when loaded in the browser. When I change them to a normal <input> tag, then it displays. It is not useful, when I am trying to develop a web application in the .Net environment. Text box property is set to Tru to begin with and then changed later in the code. see the button_click event handler code. Any help is appreciated.
thanks.

Public Class WebForm1
Inherits System.Web.UI.Page
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
Protected WithEvents Button1 As System.Web.UI.WebControls.Button

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Label1.Text = "Hello. " & TextBox1.Text & "!"
TextBox1.Visible = False
Button1.Visible = False
End Sub
End Class

<%@. Page Language="vb" AutoEventWireup="false" Codebehind="Hello.aspx.vb" Inherits="Aerosea.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<P>
<asp:Label id="Label1" runat="server">Enter a Name:</asp:Label>
<asp:TextBox id="TextBox1" runat="server" Visible="False"></asp:TextBox>
<asp:Button id="Button1" runat="server" Text="Submit" Visible="False"></asp:Button></P>
</form>
</body>
</HTML
Your problem is the visible=false in your tag...

<asp:TextBox id="TextBox1" runat="server" Visible="False"></asp:TextBox
Change this to:

<asp:TextBox id="TextBox1" runat="server" Visible="True"></asp:TextBox
and it will show up.

Basically, your code shows that you are hiding your textbox and button, and if the button were visible and someone clicked it, you are hiding it yet again......

MajorCats
Thank you very much. I totally overlooked the HTML part and thought the problem was in the Code. I changed it, and now it works.
thanks.

Text box Display

I don't understand the Display setting for controls such as text boxes.
I have a text box a button next to it, and then a submit button below
everything so that when the 1st button is pressed, a calendar appears
underneath it.

Becasue the submit button is below all the user input stuff, I want to
make it so that the calendar and the submit buttons are given set
positions on the screen, so that whenever I press the 1st button, my
submit button doesn't get pushed down the screen to make way for the
calendar.

I would've thought Display="Static" would do this, but I get the same
result as using Display="Dynamic". Can anybody help me out with this?

Any help would be really appreciated.

Thanks,

Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!You need to use absolute display but make sure the parent elements are all
setup - positioning elements in pixel offsets is not a very good thing to
do. Static is meant for something else and IE does not even support it.

Jerry

"Mike P" <mrp@.telcoelectronics.co.uk> wrote in message
news:OVZiJ#UmDHA.2772@.TK2MSFTNGP10.phx.gbl...
> I don't understand the Display setting for controls such as text boxes.
> I have a text box a button next to it, and then a submit button below
> everything so that when the 1st button is pressed, a calendar appears
> underneath it.
> Becasue the submit button is below all the user input stuff, I want to
> make it so that the calendar and the submit buttons are given set
> positions on the screen, so that whenever I press the 1st button, my
> submit button doesn't get pushed down the screen to make way for the
> calendar.
> I would've thought Display="Static" would do this, but I get the same
> result as using Display="Dynamic". Can anybody help me out with this?
>
> Any help would be really appreciated.
>
> Thanks,
> Mike
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!

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

Saturday, March 24, 2012

text search in asp.net

its urgent i want a text search in asp.net with c#

if i enter asp in text box and submit the page it has to get the pages with text syed in that page.

Help will be appriciated

Hi,

I haven't tried this yet but it migh help you:

http://www.dotnetjunkies.com/Tutorial/195E323C-78F3-4884-A5AA-3A1081AC3B35.dcik


i want text search utility for the whole of my website

Hi, Sorry but iam unable to understand this question, you entered a text asp now want pages with syed in that page(which page you want), and with what text. that text should be in the name or inside the content of the page.


1)enter the word which you want to search in your website.

2)diplay the pages where this word occurs in your website pages.


Hi, i do not know if their is some inbuilt facility to do so.What i could have done, is this way,

The project where your webpages are present is a directory . So first find the no. and names of file in that directory and put the name inside a string array.

Now we have the names of all files we have to read.

Create a foreach loop and start reading the file .This will be outermost loop . In the inner loop start reading them and match the each string with your own string .If matches skip the inner loop then save the name of that file inside another string array.Its like we do linear Search,

In the end use javascript code to open your webpage with the names retrieved from the string Array in your code behind.

--------

Its true that giving suggestions is quite easy, but some times they help.

Hope this will help


Thanks BMW,

But i got this url fewdays back and its working .

but anyhow thanks for sending me the url.


syedwna:

1)enter the word which you want to search in your website.

2)diplay the pages where this word occurs in your website pages.

Hi,

Here is a demo for you :http://www.codeproject.com/aspnet/SearchDotnet.asp

Hope this helps.


hiJerome Cui - MSFT ,

i used the application what u gave the url,it was working fine on local host

now when i put the application on live server , i got the error

The remote server returned an error: (500) Internal Server Error.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.Net.WebException: The remote server returned an error: (500) Internal Server Error.

[WebException: The remote server returned an error: (500) Internal Server Error.]
System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request) +338
System.Net.WebClient.DownloadData(Uri address) +181
System.Net.WebClient.DownloadData(String address) +26

What could be the problem.

Thursday, March 22, 2012

Textarea, form submit on return key

Hi,

Something is causing the form to be submitted whenever I hit the
return-key. Normally I wouldn't bother, but it also happens when I'm
typing in a textarea-control, which makes it impossible to fill in
multiple lines...

Where to look?

Thanks!Sjaakie schreef:
> Hi,
> Something is causing the form to be submitted whenever I hit the
> return-key. Normally I wouldn't bother, but it also happens when I'm
> typing in a textarea-control, which makes it impossible to fill in
> multiple lines...
> Where to look?
> Thanks!

It might be helpfull to know that the textarea is a multiline
textbox-control.

Cheers
Sjaakie, i tried a small sample but I can't reproduce the behavior!, can you
post some code?

Jose
"Sjaakie" <keep@.secret.it> wrote in message
news:448fd04d$0$31641$e4fe514c@.news.xs4all.nl...
> Sjaakie schreef:
>> Hi,
>>
>> Something is causing the form to be submitted whenever I hit the
>> return-key. Normally I wouldn't bother, but it also happens when I'm
>> typing in a textarea-control, which makes it impossible to fill in
>> multiple lines...
>>
>> Where to look?
>>
>> Thanks!
> It might be helpfull to know that the textarea is a multiline
> textbox-control.
> Cheers
Jose Rodriguez schreef:
> Sjaakie, i tried a small sample but I can't reproduce the behavior!, can you
> post some code?
> Jose
> "Sjaakie" <keep@.secret.it> wrote in message
> news:448fd04d$0$31641$e4fe514c@.news.xs4all.nl...
>> Sjaakie schreef:
>>> Hi,
>>>
>>> Something is causing the form to be submitted whenever I hit the
>>> return-key. Normally I wouldn't bother, but it also happens when I'm
>>> typing in a textarea-control, which makes it impossible to fill in
>>> multiple lines...
>>>
>>> Where to look?
>>>
>>> Thanks!
>> It might be helpfull to know that the textarea is a multiline
>> textbox-control.
>>
>> Cheers

Jose,
I tried to cancel this posting, but apparently it was already replicated
to other servers.

It turned out it was just me being stupid. I was confident I had set the
property 'Multiline', but I didn't ... so it behaved as a regular textbox.

Thanks for your support anyway.

Cheers,
Sjaak

Textarea, form submit on return key

Hi,
Something is causing the form to be submitted whenever I hit the
return-key. Normally I wouldn't bother, but it also happens when I'm
typing in a textarea-control, which makes it impossible to fill in
multiple lines...
Where to look?
Thanks!Sjaakie schreef:
> Hi,
> Something is causing the form to be submitted whenever I hit the
> return-key. Normally I wouldn't bother, but it also happens when I'm
> typing in a textarea-control, which makes it impossible to fill in
> multiple lines...
> Where to look?
> Thanks!
It might be helpfull to know that the textarea is a multiline
textbox-control.
Cheers
Sjaakie, i tried a small sample but I can't reproduce the behavior!, can you
post some code?
Jose
"Sjaakie" <keep@.secret.it> wrote in message
news:448fd04d$0$31641$e4fe514c@.news.xs4all.nl...
> Sjaakie schreef:
> It might be helpfull to know that the textarea is a multiline
> textbox-control.
> Cheers
Jose Rodriguez schreef:
> Sjaakie, i tried a small sample but I can't reproduce the behavior!, can y
ou
> post some code?
> Jose
> "Sjaakie" <keep@.secret.it> wrote in message
> news:448fd04d$0$31641$e4fe514c@.news.xs4all.nl...
>
Jose,
I tried to cancel this posting, but apparently it was already replicated
to other servers.
It turned out it was just me being stupid. I was confident I had set the
property 'Multiline', but I didn't ... so it behaved as a regular textbox.
Thanks for your support anyway.
Cheers,
Sjaak

Tuesday, March 13, 2012

Textbox and its corresponding submit button.

I noticed that if I hit enter in the text box instead of clicking on the submit button that the page just refreshes and bttn_click event doesn't occur for the submittal.

After a search I found the following to work:

ClientScript.RegisterHiddenField(string hiddenFieldName, string hiddenFieldInitialValue)

From what I gather this allows the page to have a default button event occur whenever the enter key is pressed in a text box.

My question is how would you go about setting this up for more than one text box and submit button on a page that will do different things other than the default.

I found this:
this.userTxtBx.Attributes.Add("onkeypress", "setEnterKey('userBttn')");
but it does not work in my attempts.

Thanks in advance.After contemplating the problem further, I realize the problem is not so complex.
The simplest solution is html form code defaultbutton=""
Another way is to have a hidden textbox field in your form.

Read this too
http://aspnet.4guysfromrolla.com/articles/060805-1.aspx
Thank you for this.