如何在asp.net中将日期作为查询字符串值传递 [英] How to pass date as a querystring value in asp.net
本文介绍了如何在asp.net中将日期作为查询字符串值传递的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我在下拉列表中选择了一个日期,然后单击查看按钮,则它将重定向到另一页并显示该日期的详细信息.我该怎么做.
有人可以帮我吗?
谢谢与问候
Thendral
解决方案
hai,
您必须在str
中使用dropdowndownvalue 喜欢
str = DropDownList1.SelectedValue; Response.Redirect(" + str); 然后在重定向页面 此 .Label1.Text = Request.QueryString [" ].ToString();
您将获得在上一页中选择的值
选项#1: String.Format(" ,HttpUtility.UrlEncode( 时间 .ToString(" ) )); 选项#2: 您也可以使用 EncodeHTML()/DecodeHTML() 选项#3: 如果您想对自己进行编码,然后将" 替换为 " 和替换页面中的 您在其中 span class ="code-keyword">读取查询字符串.
If i selected one date in dropdownlist and click the view button means it will redirect to another page and display the details for that date.how can i do this..
can anyone help me?
Thanks & Regards
Thendral解决方案hai,
u have to take dropdowndownvalue in str
like
str = DropDownList1.SelectedValue; Response.Redirect("redirect.aspx?date="+str); then in redirect page this.Label1.Text = Request.QueryString["date"].ToString();
u will get value which u select in previous page
Option#1: String.Format("~/YourWebPage.aspx?datecol={0}", HttpUtility.UrlEncode(time.ToString("o"))); Option#2: You can also use EncodeHTML()/DecodeHTML() for this Option#3: if you want to encode yourself, then replace the "\" with "%2F" and replace in the page where you read the querystring.
这篇关于如何在asp.net中将日期作为查询字符串值传递的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文