goodk
asked on
How to pass parameters with spaces to the new page?
I want pass,
City of Dallas as a parameter.
http://www.myWebsite.com/NewPage?City of Dallas
I only seem to be receiving City. How to do it right? thanks
spaces should be sent as "%20"
http://www.example.com/NewPage?City%20of%20Dallas
however, as mentioned above, anything passed in the url should be encoded properly.
http://www.example.com/NewPage?City%20of%20Dallas
however, as mentioned above, anything passed in the url should be encoded properly.
you can simply put this inside quotes, or can use "%20" as space character as mentioned above.
so if you pass it inside an anchor tag, then
<a href="http://www.myWebsite.com/NewPage?City of Dallas">click here</a>
Try It!
Use the escape javascript function
document.location = "http://www.testing.com?" + escape("City of Dallas");
document.location = "http://www.testing.com?" + escape("City of Dallas");
Try using Server.HTMLEncode("City of Dallas")
use the code i have tried this code:
ASKER
reader.GetName(fcount)="Ci ty of Dallas" <-- in database
temphrefstr ="AnyTable.aspx?TableName= AceData&xF ieldName=" +sValue1 + "&xFieldValue=" + HttpContext.Current.Server .HtmlEncod e(reader.G etName(fco unt)) + "&xFieldName1=" + sValue2 + "&xFieldValue2=" + hArray[fcount];
hrefstr = "<a href=" + temphrefstr + ">" + tmpreader + InvestmentClosedDate + "</a>";
I only see City instead of City of Dallas
http://localhost:58297/Prod/AnyTable.aspx?TableName=AceData&xFieldName=Job&xFieldValue=City
please help! thanks
temphrefstr ="AnyTable.aspx?TableName=
hrefstr = "<a href=" + temphrefstr + ">" + tmpreader + InvestmentClosedDate + "</a>";
I only see City instead of City of Dallas
http://localhost:58297/Prod/AnyTable.aspx?TableName=AceData&xFieldName=Job&xFieldValue=City
please help! thanks
Insert this:
temphrefstr = Server.HTMLEncode("temphre fstr");
temphrefstr = Server.HTMLEncode("temphre
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Here's an update. Use this will be correctly solve your issue.
hrefstr = "<a href=" + HttpUtility.UrlEncode(temp hrefstr) + ">" + tmpreader + InvestmentClosedDate + "</a>";
hrefstr = "<a href=" + HttpUtility.UrlEncode(temp
hi dear i have tried this code which is working for me the same thing
string strq = "City of Dallas";
lbllink.Text = "http://www.myWebsite.com/N ewPage?cit y=City of Dallas";
string strq = "City of Dallas";
lbllink.Text = "http://www.myWebsite.com/N
hi dear i have tried this code which is working for me the same thing
string strq = "City of Dallas";
lbllink.Text = "<a href=\"http://www.myWebsite.com/NewPage?city=" + strq + "\">http://www.myWebsite.com/NewPage?city=City of Dallas</a>";
string strq = "City of Dallas";
lbllink.Text = "<a href=\"http://www.myWebsite.com/NewPage?city=" + strq + "\">http://www.myWebsite.com/NewPage?city=City of Dallas</a>";
string strq = "City of Dallas";
lbllink.Text = "<a href=\"http://www.myWebsite.com/NewPage?city=" + strq + "\">http://www.myWebsite.com/NewPage?city=City of Dallas</a>";
ASKER
http://localhost:58297/Prod/AnyTable.aspx?TableName=AceData&xFieldName=Job&xFieldValue=CCncr&xFieldName1=PayedTo&xFieldValue2=ACE PBNB Account
ok, on the receiving end do i have to do anything special. or just something like this? please help! thanks
if (Request.QueryString["xFie ldValue2"] != null)
string xWhere = "Where " + xFieldName1 + "='" + xFieldValue2 + "'"
ok, on the receiving end do i have to do anything special. or just something like this? please help! thanks
if (Request.QueryString["xFie
string xWhere = "Where " + xFieldName1 + "='" + xFieldValue2 + "'"
http://www.permadi.com/tutorial/urlEncoding/