When you click query or export a report, the query is performed based on the query conditions, but the server side is definitely not an action. At this time, you need to submit a form and call different actions.
Jquery
$ (Document). Ready (function (){
$ ("# Btnsearch, # btnexport"). Click (function (){
$ ("# Issearch"). ATTR ("value", 1 );
VaR action = $ (this). Data ("action ");
$ ("Form") [0]. Action = action;
VaR selectname = $ ("# activelistname"). Find ("option: Selected"). Text ();
If (selectname = "select "){
Return alert ("select activity name ");
}
Else {
$ ("Form") [0]. Submit ();
}
});
HTML:
@ Using (html. beginform ())
{
@ Html. textboxfor (n => N. issearch, new {@ type = "hidden "})
<Table class = "Table-striped table-bordered displaytable" id = "displaytable">
<Tbody>
<Tr class = "odd">
<TD class = "right">
Activity time:
</TD>
<TD class = "Left" colspan = "3" style = "vertical-align: middle;">
From: @ HTML. textboxfor (model => model. begindate, new {@ class = "wdate", @ onclick = "wdatepicker ({LANG: 'zh-cn '})"})
To: @ HTML. textboxfor (model => model. enddate, new {@ class = "wdate", @ onclick = "wdatepicker ({LANG: 'zh-cn '})"})
</TD>
</Tr>
@{
Html. renderaction ("searchareausercontrol", "staff", model = NULL? Null: New areausercontrolviewmodel {areaid = model. areaid, clusterid = model. clusterid, filialeid = model. filialeid, salescode = model. salescode, channelid = model. channelid
});
}
<Tr>
<TD class = "right">
Activity name
</TD>
<TD class = "Left" style = "vertical-align: middle;">
@ Html. dropdownlistfor (M => M. activelistname, new [] {
New selectlistitem () {text = "f1", value = "f1 "},
New selectlistitem () {text = "Mu", value = "Mu "}
}, "Select ")
</TD>
<TD colspan = "2">
</TD>
</Tr>
<Tr>
<TD class = "right">
Site code/account
</TD>
<TD class = "Left" style = "vertical-align: middle;">
@ Html. textboxfor (model => model. sitecode, new {@ class = "input span3 number "})
</TD>
<TD colspan = "2">
</TD>
</Tr>
<Tr>
<TD class = "right">
Company Name
</TD>
<TD class = "Left" style = "vertical-align: middle;">
@ Html. textboxfor (model => model. Name, new {@ class = "input span3 number "})
</TD>
<TD colspan = "2">
</TD>
</Tr>
</Tbody>
</Table>
<Div class = "btn_usebox">
<Table>
<Tr>
<TD>
<Input type = "button" class = "btn_use" data-action = "@ URL. Action (" activelist ")" id = "btnsearch" value = ""/>
</TD>
<TD>
<Input type = "button" id = "reset" class = "btn_use" value = "Clear all"/>
</TD>
<TD>
<Input type = "button" class = "btn_use" data-action = "@ URL. Action (" exportforactive ")" id = "btnexport" value = "export report"/>
</TD>
</Tr>
</Table>
</Div>
}
</Div>