读书人

小弟我该怎么获得这里面的值

发布时间: 2012-01-07 21:41:56 作者: rapoo

我该如何获得这里面的值?
原代码如下:
protected string GetSearchNavigation()
{
//@ "onsubmit=return if(frm.txtoption.value== ' '){alert( '请输入查询关键字! ') ";
return @ " <h1> <a href= 'index.html ' title= 'MOTO WOW '> <span> MOTO WOW </span> </a> </h1>
<form id= 'frm ' action= 'Search.aspx?menu_id=11&keyword=22 '>
<img src= '/images/top_person.gif ' alt= '员工专享 ' /> <select id= 'seloption ' name= ' ' size= '1 ' class= 'selcet '>
<option value= '38 '> 产品 </option>
<option value= '39 '> 内容1 </option>
<option value= '40 '> 内容2 </option>
</select> <img src= '/images/searchline.gif ' align= 'absmiddle ' style= 'margin-left:10px; margin-right:10px '/>
<input name= 'txtoption ' type= 'text ' value= '站内搜索 ' />
<input name= ' ' type= 'image ' src= '/images/btn_search_top.gif ' class= 'btn ' />
</form> ";
//frm.seloption.value
//frm.seloption.value
}
这个是自动生成网页的自动搜索的代码段,这个在调用上是没问题的
但我运行这个生成的网页时,问题出现了
在浏览器的url框中显示这个东西:
http://localhost/cds/Search.aspx?=38&txtoption=aaa&x=9&y=15
他怎么把我的控件名字打上去了?
本来如果按照form的action参数应该是menuid=38&keyword=aaa

这个查询是用 <input type= "image "> 这种html表单控件提交的,可是结果并不是我想要的,后来我将结果固定成上面那样了,我取个定值,然后重新生成,刷新再查还是这个结果:
http://localhost/cds/Search.aspx?=38&txtoption=aaa&x=9&y=15
我后来加了测试输出:
public partial class cds_Search : System.Web.UI.Page
{
private int menu_uid = 0;


private int con_id = 0;
private int selectpage = 1;
private string selectvalue = " ";
private string searchstring = " ";
protected void Page_Load(object sender, EventArgs e)
{
new OgilvyOne.ProcessFlow.StaffInfoController().getStaffSession();
VarInit();
Response.Write( "menu_id= " + menu_uid+ " <br> ");
Response.Write( "key= " + searchstring);
string htmlscript= " ";
Response.Write(htmlscript);
}
private void VarInit()
{
menu_uid = IntUtil.ToSafeInt(Request[ "menu_id "]);
con_id = IntUtil.ToSafeInt(Request[ "con_id "]);
selectpage = IntUtil.ToSafeInt(Request[ "page "], 1);
selectvalue = StringUtil.ToSafeString(Request[ "selectvalue "]);
searchstring = StringUtil.ToSafeString(Request[ "keyword "]);
}
}
结果输出:
menu_id=0
key=
现在我该如何在这个文件中获取值?

[解决办法]
他怎么把我的控件名字打上去了?
本来如果按照form的action参数应该是menuid=38&keyword=aaa

===========

因为用了 get 方式提交

<form id= 'frm ' action= 'Search.aspx?menu_id=11&keyword=22 '>

》》》

<form id= 'frm ' action= 'Search.aspx?menu_id=11&keyword=22 ' method= 'post '>

读书人网 >asp.net

热点推荐