首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

还是获得值的有关问题求救SOS

2012-02-17 
还是获得值的问题求救SOS我要用formid frmaction Search.aspx?menu_idfrm.seloption.value&keywordfr

还是获得值的问题求救SOS
我要用
<form   id= 'frm '   action= 'Search.aspx?menu_id=frm.seloption.value&keyword=frm.txtoption.value '   method= 'post '>
获得表单提交的值
原代码如下:

public   partial   class   cds_Search   :   System.Web.UI.Page
{
        private   int   menu_id   =   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_id+ " <br> ");
                Response.Write( "key= "   +   searchstring);

                ContentController   icon   =   new   ContentController();
                if   (con_id   >   0   &&   menu_id   !=   ConfigUtil.GetIntValue( "EventFocuss "))
                {
                        ConInfo   info   =   icon.getContentInfo(con_id);
                        if   (info   !=   null)
                        {
                                string   linkUrl   =   info.LinkUrl;
                                if   (linkUrl   !=   null)
                                {
                                        if   (linkUrl.Trim().Length   >   0)
                                        {
                                                Response.Redirect(linkUrl,   true);
                                        }
                                }
                        }
                }
                string   htmlscript   =   icon.GetContent(menu_id,   con_id,   selectpage,   selectvalue,   searchstring);


                Response.Write(htmlscript);
                Response.End();
        }
        private   void   VarInit()
        {
                menu_id   =   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 "]);
        }

protected   string   GetSearchNavigation()
                {
                        //@ "onsubmit=return   if(frm.txtoption.value== ' '){alert( '请输入查询关键字! ') ";
                        return     <form   id= 'frm '   action= 'Search.aspx?con_id=frm.seloption.value&keyword=frm.txtoption.value '   method= 'post '>
                                <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.txtoption.value


                }


结果输出就不对了
url栏中:
http://localhost/cds/Search.aspx?menu_id=frm.seloption.value&keyword=frm.txtoption.value

页面输出:
menu_id=0
key=frm.txtoption.value

[解决办法]
<input type=button onclick=SubmitMe() />

// js

function SubmitMe()
{
frm.action= 'Search.aspx?menu_id= ' + frm.seloption.value + '&keyword= ' + frm.txtoption.value ';
frm.submit();
}
[解决办法]
frm.action= 'Search.aspx?menu_id= ' + frm.seloption.value + '&keyword= ' + frm.txtoption.value ';

> > 末尾多一个 引号

frm.action= 'Search.aspx?menu_id= ' + frm.seloption.value + '&keyword= ' + frm.txtoption.value;

热点排行