|
use query string or sessions to pass value
Response.Redirect
("index.htm?username=" +
TextBox1.Text = Request.QueryString["username"].ToString();
|
|
|
|
|
How could i use TextBox1.Text on HTML page....
TextBox1.Text = Request.QueryString["username"].ToString(); ???????
|
|
|
|
|
So you've to manually handle/manipulate the string data by JavaScript and feed it to the control.
|
|
|
|
|
To obtained by plain HTML (no ASP.NET needed):
Although this is definitely not the best practise.
And am still not very sure if this is what you are looking for.
< html >
< head >
< title>index< /title >
< meta http-equiv="REFRESH" content="0;url=http://www.xyz.com/xyz.aspx" >
< /head >
< body >
Index page.
< /body >
< /html >
using a JavaScript code:
< html >
< head >
< title >index< /title >
< /head >
< body >
< script language="javascript" >
window.location = "http://www.xyz.com/xyz.aspx";
< /script >
Index page.
< /body >
< /html >
|
|
|
|
|
Hello All
i've a usercontrol with alot of items i want to customize it for each individual page ,for instance making some textboxes,buttons invisible in a particular page , how to?
thanks
modified on Sunday, November 8, 2009 1:39 AM
|
|
|
|
|
What is the problem. Expose some properties from the usercontrol to set it from any page.
|
|
|
|
|
check the properties of the user control you are using. Also u can add controls to it like text box etc , if it supports them and then set the properties as per you requirment. If the user control doesn't support then change to a custom aspx control as per your requirments.
|
|
|
|
|
Thank you sir , but i was thinking of having a sub that handles all the control intead of exposing each individual item , i vame up with this sub , and it works just fine
Public Sub _DisableCont(ByVal Cont_Str As String)
Dim _Control As Control
For Each _Control In Me.Controls
Dim _ControlToString As String = _Control.ToString
If _ControlToString = Cont_Str Then
_Control.Visible = False
End If
Next
End Sub
|
|
|
|
|
Just see you have already did yourself. Our main motive is to help you to solve your own problem yourself.
Just to add to your solution, if you need any particular control to do something else check using this :
If TypeOf(_Control) is TextBox Then
Dim tb as TextBox = DirectCast(_Control, TextBox)
tb.ReadOnly = True
End If
You might also take Select Case in account for this scenario.
Cheers.
|
|
|
|
|
Hi,
I have two pages in my website 1.Welcome.aspx 2.Search.aspx
Welcome.aspx has two text boxes. Keyword and Location
User types in keyword and Location and clicks Search button
User gets redirected to search.aspx page
The values of Keyword and Location is stored in session and these values are utilized in Pageload to show the values in grid in search.aspx page.
Hence the url of this page is always http://sitename/search.aspx
However in order to get higher rating using SEO methods I plan to include the
keyword and location in url like http://sitename/search.aspx/keyword/Location
How can this be done? is it possible to read values stored in session and modify the url dynamically?
WelcomePage Code
-------------------------------------------------------------
protected void On_btnSearch_Click(object sender, ImageClickEventArgs e)
{
Session["searchWord"] = txtSearchWords.Text;
Session["location"] = txtLocation.Text;
Response.Redirect("Search.aspx");
}
--------------------------------------------------------------
SearchPageCode
--------------------------------------------------------------
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
//Receiving the searchWords from the calling pages.
if (Session["searchWord"] == null)
{
Server.Transfer("Welcome.aspx");
}
else
{
txtSearchWords.Text = Session["searchWord"].ToString();
txtLocation.Text = Session["location"].ToString();
Session.Remove("searchWord");
Session.Remove("location");
}
if (!txtSearchWords.Text.Equals(""))
{
grdResultRefresh();
}
}
--------------------------------------------------------
|
|
|
|
|
Hari1919 wrote: http://sitename/search.aspx/keyword/Location
How about this
http://sitename/search.aspx?kw=seol&location=brigetown
It is easier if you show using query string bcos you can use Request.QueryString.
Otherwise you need to create one handler that might process your special request and get the values from /keyword/location.
Hari1919 wrote: he values of Keyword and Location is stored in session
You dont need to store this in session as you send already in querystring. Use
Response.Redirect("search.aspx/keyword/Location");
|
|
|
|
|
That would a lot easier............
|
|
|
|
|
Hi,
In my asp.net web form's page_load event, I want to check if the query string 'id' is there or not. If not, then transfer the user to another page. Now, I am using this code.
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["id"] == null)
{
Response.Redirect(ResolveUrl("~/Projects"));
return;
}
int x = 5;
int y = 4;
doSomething(x,y);
}
Now, my question is, DO I NEED TO CALL THE 'return' STATEMENT after Response.Redirect(ResolveUrl("~/Projects"));
call ? Wont the page automatically die after this Redirect method call ? Thanks.
|
|
|
|
|
I am not sure,but there is no need of return statement after the response.redirect();
|
|
|
|
|
i dont think so any statemnt will be executed after page is redirected.....
|
|
|
|
|
If You want to be Dobly Sure use this
Response.Redirect(ResolveUrl("~/Projects"),true);
This will end the excecution of Current page .....
No Need of using Return
|
|
|
|
|
Is that the problem that you are afraid that below code will execute after Response.Redirect executes, isnt it?
so dont be afraid.
if the program reaches that Response.Redirect line, it normally stop executing that process and pass the control to next process, it will never execute below coding
int x = 5;
int y = 4;
doSomething(x,y);
|
|
|
|
|
Thanks San for your helpful answer.
|
|
|
|
|
hii m using the access database in my website.
its working f9 but as soon as i use to modify or update the data it gives error.
however on localhost its working f9.what shud i do....
The access database is in appdata folder of website.
plz guide...
|
|
|
|
|
Hi,
do you get a specific error message? If yes, please post the message. By the way, what means f9?
Regards
Sebastian
|
|
|
|
|
no it doesnt shows the details of error....
it shows:
To enable the details of this specific error message to be viewable on remote machines, please create a <customerrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customerrors> tag should then have its "mode" attribute set to "Off".
f9 means fine...
|
|
|
|
|
Then I would suggest that you enable the details of the error message by adding the tag as described. If you did that, run the code again to get the details of the error message and post it.
|
|
|
|
|
i have done but it gives same error...
|
|
|
|
|
Can you login to the machine that hosts your app? If yes try to create the error during a localhost-session. Then you will hopefully see more error details. (You could also take a look into the System Event Log if the error message is described there in more detail).
|
|
|
|
|
check your access. You might not have access.
how do you connect to databse on localhost?
|
|
|
|