I Have a textbox in a form. user can enter string value in it. page is posted in same page. after submitting the value, by get method, some other information will be displayed in mulitple pages.
its showing current number of records, but value of the TEXT BOX does not retain, as soon as user clicks next page.
anybody ne idea in that?
7 6944
Hi Nudrat,
If you are doing this in classic ASP (v3), then it's a common symptom. Classic ASP doesn't save the ViewState of an element - so if you post a form to it's parent page, when the page reloads, the form data has disappeared.
The easy way of doing this is (as it's only a textbox) is as follows:
<input type="text" name="myTextBox" value="<%=Request.Form("myTextBox")%>" />
That way, when the page is being processed by the ASP extensions, the textbox will be automatically populated when loaded with whatever the user typed in there last time.
All the best,
medicineworker
N.B. As the problem is occurring when your user jumps to the next page, I take it your links are dynamically generated - so you have, say, 20 results per page, and then user can click page 1, page 2 etc.?
When doing search-engine type scripts, I pass a couple of QueryString parameters - namely whatever string the user is searching on ("searchq"), then how many results they want per page ("retmod"), and at what record index to begin printing results. That way, I can then automatically produce code for page numbers (page 1 of results etc.) like so: -
<%
-
For I = 0 To Mod(rsResults.RecordCount,CInt(Request.QueryString("retmod")))
-
%><a href="results.aspx?searchq=<%=Request.QueryString("searchq")%>&retmod=<%=Request.QueryString("retmod")%>&begin=<%=Request.QueryString("bc")%>"><%=I%></a>
-
<%
-
Next
-
%>
Hi,
I have already used the same code, which u have suggested. Its not working.
<input type="text" name="myTextBox" value="<%=Request.Form("myTextBox")%>" />
the value reatin as long as user is submitting it in a single page, but as soon as he clicks next page, value of the text box disappears.
Help is required.
Nudrat
Hi Nudrat,
If you are doing this in classic ASP (v3), then it's a common symptom. Classic ASP doesn't save the ViewState of an element - so if you post a form to it's parent page, when the page reloads, the form data has disappeared.
The easy way of doing this is (as it's only a textbox) is as follows:
<input type="text" name="myTextBox" value="<%=Request.Form("myTextBox")%>" />
That way, when the page is being processed by the ASP extensions, the textbox will be automatically populated when loaded with whatever the user typed in there last time.
All the best,
medicineworker
N.B. As the problem is occurring when your user jumps to the next page, I take it your links are dynamically generated - so you have, say, 20 results per page, and then user can click page 1, page 2 etc.?
When doing search-engine type scripts, I pass a couple of QueryString parameters - namely whatever string the user is searching on ("searchq"), then how many results they want per page ("retmod"), and at what record index to begin printing results. That way, I can then automatically produce code for page numbers (page 1 of results etc.) like so: -
<%
-
For I = 0 To Mod(rsResults.RecordCount,CInt(Request.QueryString("retmod")))
-
%><a href="results.aspx?...
-
<%
-
Next
-
%>
nudrat,
I think MedicineWorker may have hit on something you didn't catch. The user has typed info into a text box in a form but is NOT SUBMITTING the form. If you need this data to be passed on to the next page, you will need to submit the data in one way or another. For example, if you want to still use the "next page" link, you could remove the href attribute of the link and add a onClick statement like this: - <a onClick="document.all.form1.action='nextPage.asp';document.all.form1.submit()">Next Page</a>
Let me know if this helps.
Jared
Thanks for the reply jhardman,
i tried ur code, it didn't worked,.. im just pasting my total code. let me know, where im going wrong, -
<%
-
strURL=Request.ServerVariables("url")
-
varX=Request.QueryString("txtText1")
-
set rsPaging=Server.CreateObject("adodb.recordset")
-
strPaging="select * from nudrat where name='"&varX&"'"
-
iPageSize = 1
-
-
If Request.QueryString("page") = "" Then
-
iPageCurrent = 1
-
Else
-
iPageCurrent = CInt(Request.QueryString("page"))
-
End If
-
-
rsPaging.PageSize = iPageSize
-
rsPaging.CacheSize = iPageSize
-
rsPaging.open strPaging,con, 3,1, &H0001
-
-
%>
-
<form action="ValFixed.asp" method="get" name="frm1">
-
<input type="text" name="txtText1" id="txtText" value="<%=Request.QueryString("txtText1")
-
%>">
-
<input type="submit" value="click">
-
<%
-
iPageCount = rsPaging.PageCount
-
If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
-
If iPageCurrent < 1 Then iPageCurrent = 1
-
If iPageCount = 0 Then
-
%>
-
<table align="center"><tr><td align="center">
-
<% Response.Write "No records found!"%>
-
</td></tr></table> <%Else rsPaging.AbsolutePage = iPageCurrent%>
-
-
<table width="404" border="1">
-
<tr>
-
<td width="33"><strong>SiNo</strong></td>
-
<td width="40"><strong>Name</strong></td>
-
<td width="27"><strong>Age</strong></td>
-
<td width="43"><strong>Salary</strong></td>
-
<td width="80"><strong>Designation</strong></td>
-
<td width="141"><strong>Applied Date</strong></td>
-
</tr>
-
<%
-
iRecordsShown = 0
-
Do While iRecordsShown < iPageSize And Not rsPaging.EOF
-
%>
-
<tr>
-
<td><%=rsPaging.absoluteposition%></td>
-
<td><%=rsPaging("Name")%></td>
-
<td><%=rsPaging("Age")%></td>
-
<td><%=rsPaging("Salary")%></td>
-
<td><%=rsPaging("Designation")%></td>
-
<td><%=rsPaging("MyDate")%></td>
-
-
<% iRecordsShown = iRecordsShown + 1
-
i=i+1 rsPaging.MoveNext%>
-
</tr> <%Loop%>
-
</table>
-
<% end if %>
-
<%If iPageCurrent > 1 Then
-
%>
-
<a href="<%=strURL%>?page=<%=iPageCurrent -1%>&myText=<%=Request.QueryString("txtText1") %>">Prev</a>
-
<%
-
End If
-
For I = 1 To iPageCount
-
If I = iPageCurrent Then%> <%= I %>
-
<%Else%>
-
<a href="<%=strURL%>?page=<%=iPageCurrent %>&myText=<%=Request.QueryString("txtText1") %>"><%= I %></a>
-
<% End If
-
Next
-
If iPageCurrent < iPageCount Then
-
%>
-
<a href="<%=strURL%>?page=<%=iPageCurrent+1%>&myText=<%=Request.QueryString("txtText1") %>"> Next </a>
-
<%
-
End If
-
%>
-
</font></td>
-
<td> <p> <font size="2" face="Arial, Helvetica, sans-serif">Page <strong><%= iPageCurrent %></strong> of <strong><%= iPageCount %></strong></font>
-
</p>
-
</td>
-
</div>
-
-
-
</form>
Regards
Nudrat
nudrat,
I think MedicineWorker may have hit on something you didn't catch. The user has typed info into a text box in a form but is NOT SUBMITTING the form. If you need this data to be passed on to the next page, you will need to submit the data in one way or another. For example, if you want to still use the "next page" link, you could remove the href attribute of the link and add a onClick statement like this: - <a onClick="document.all.form1.action='nextPage.asp';document.all.form1.submit()">Next Page</a>
Let me know if this helps.
Jared
I would try using POST instead of GET - let me know if that helps any.
I notice that in this page you refer to the text in question as "txtText1", but you send it to the next page as "myText". Could this be causing your problem? When in doubt, it is often a good idea to list all of the data sent to your asp page: - for each x in request.querystring
-
response.write x & ": " & request.queryString(x) & "<br>" & vbNewLine
-
next
-
-
for each x in request.form
-
response.write x & ": " & request.form(x) & "<br>" & vbNewLine
-
next
-
-
for each x in request.cookies
-
response.write x & ": " & request.cookies(x) & "<br>" & vbNewLine
-
next
-
-
for each x in request.serverVariables
-
response.write x & ": " & request.serverVariables(x) & "<br>" & vbNewLine
-
next
now you probably don't need all of these, but this will verify what is being sent to the next page.
Jared
Thanks Jared for the reply,
It worked at last,
I have to close the form tag after the submit button,
Paging code will appear when form tag has been closed.
myText is the alias name, so it will not make any difference.
Regards
Nudrat
I notice that in this page you refer to the text in question as "txtText1", but you send it to the next page as "myText". Could this be causing your problem? When in doubt, it is often a good idea to list all of the data sent to your asp page: - for each x in request.querystring
-
response.write x & ": " & request.queryString(x) & "<br>" & vbNewLine
-
next
-
-
for each x in request.form
-
response.write x & ": " & request.form(x) & "<br>" & vbNewLine
-
next
-
-
for each x in request.cookies
-
response.write x & ": " & request.cookies(x) & "<br>" & vbNewLine
-
next
-
-
for each x in request.serverVariables
-
response.write x & ": " & request.serverVariables(x) & "<br>" & vbNewLine
-
next
now you probably don't need all of these, but this will verify what is being sent to the next page.
Jared
Sign in to post your reply or Sign up for a free account.
Similar topics
by: melvynadam |
last post by:
If I open a new page with very little text on it such as
a bugmenot
results page is there a way to select some of the text there and
assign it to variables?
Selecting all and copying to the...
|
by: Mark Harris |
last post by:
I have an installer which uses a Customer Information page in it, is there
an easy way to pass the
serial number entered to a custom action?
If not, where would i find the serial number in the...
|
by: A Ward |
last post by:
I am trying to find a way to have multiple seperate ASP.Net applications
where I can response.redirect() to a second web application and pass
information. From what I have tried:
* HTTP-GET - I...
|
by: BerkshireGuy |
last post by:
I want to open a word document from an Access form and transfer data
from the Access form to the Word Document.
For instance, if a user clicks an option box on my access form, I want
to pass...
|
by: Dhruba Bandopadhyay |
last post by:
I am using a <asp:TextBox TextMode="Password"... etc.
however it doesn't retain it's text through postbacks, whereas other
textboxes do.
Does anyone know how to retain the text?
|
by: nona |
last post by:
Hi all,
i need some help here,
i'm using a datagrid on my ASP.net application, inside the datagrid was inserted a hyperlink on the table
this hyperlink was passing information about the data set...
|
by: cmpcrand |
last post by:
Hi again.
I have created 2 web applications on the local server, in the form:
http://localserver/TestApp1
http://localserver/TestApp2
I have set both of these pages to run in SqlServer mode...
|
by: destiny007 |
last post by:
can any one help me to write code to capture selected text from a page but problem is that i am not able to decide where to call the functio.in this case the function is called in all cases of mouse...
|
by: iDesmet |
last post by:
Good day!
I was wondering if someone could show me the way with this little
problem I have.
I need to get the value/text of every checked SubItems in a listview
so I can execute a Sub.
The...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |