Asp.net 如何将下拉列表的值从.aspx传递到.asmx.cs?
我的p1.aspx上有一个下拉列表:Asp.net 如何将下拉列表的值从.aspx传递到.asmx.cs?,asp.net,asmx,Asp.net,Asmx,我的p1.aspx上有一个下拉列表: <select id="ListBoxViewType" style="width:160px;font-family:Tahoma;visibility:hidden;"> <option value="Amendment">Amendment</option> <option value="Agreement">
<select id="ListBoxViewType" style="width:160px;font-family:Tahoma;visibility:hidden;">
<option value="Amendment">Amendment</option>
<option value="Agreement">Full Terms Amendment</option>
<option value="Both">Both</option>
</select>
修正案
完整条款修订
二者都
我需要得到p2.asmx.cs上的值:
if ( <insert something like this: ListBoxViewType.Value=="Amendment">)
{
fileName = chReadData.ContractNumber +"_Amendment" +"-" + chReadData.DisplaySupplementNumber;
description = "Amendment for " + chReadData.ContractNumber + "-" + chReadData.DisplaySupplementNumber + " (\"" + chReadData.ContractDescription + "\")";
}
else
{
fileName = chReadData.ContractNumber +"_Full_Amendment" +"-" + chReadData.DisplaySupplementNumber;
description = "Amendment for " + chReadData.ContractNumber + "-" + chReadData.DisplaySupplementNumber + " (\"" + chReadData.ContractDescription + "\")";
}
if()
{
fileName=chReadData.ContractNumber+“_-Amendment”+“-”+chReadData.DisplayAddmentNumber;
description=“对“+chReadData.ContractNumber+”—“+chReadData.DisplaySupplementNumber+”(\“”+chReadData.ContractDescription+“\”)的修改”;
}
其他的
{
fileName=chReadData.ContractNumber+“\u Full\u modification”+“-”+chReadData.DisplaySupplementNumber;
description=“对“+chReadData.ContractNumber+”—“+chReadData.DisplaySupplementNumber+”(\“”+chReadData.ContractDescription+“\”)的修改”;
}
只需将runat=“server”
添加到所选元素:
<select id="ListBoxViewType" runat="server" style="width:160px;font-family:Tahoma;visibility:hidden;">
<option value="Amendment">Amendment</option>
<option value="Agreement">Full Terms Amendment</option>
<option value="Both">Both</option>
</select>
另外,您应该考虑使用<代码> DROPPDROUNDUCT控件来代替:
<asp:DropDownList ID="ListBoxViewType" runat="server"....
<asp:DropDownList ID="ListBoxViewType" runat="server"....
this.ListBoxViewType.SelectedValue
this.ListBoxViewType.SelectedItem.Text
this.ListBoxViewType.SelectedItem.Value