基于下拉列表,我正在获取价值并需要用于 ajax 文件上传,现在的问题是我正在正确获取价值,我正在使用两个 ajax 文件上传(ajaxUpload1_OnUploadComplete 和 ajaxUpload2_OnUploadComplete),每当我单击上传控件时从两个控件上传文件转到一个上传方法(ajaxUpload1_OnUploadComplete)仅用于上传文件。我需要一个解决方案。提前致谢。
在 .cs
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
Session["Value"] = DropDownList1.SelectedItem.Text;
}
protected void ajaxUpload1_OnUploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
{
String value = Session["Value"].ToString();
}
protected void ajaxUpload2_OnUploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
{
String value1 = Session["Value"].ToString();
}
在 .aspx 中
<asp:AjaxFileUpload ID="AjaxFileUpload1" AllowedFileTypes="jpg,jpeg" MaximumNumberOfFiles="10" ThrobberID="1" ContextKeys="1" OnUploadComplete="ajaxUpload1_OnUploadComplete" runat="server"/>
<asp:AjaxFileUpload ID="AjaxFileUpload2" AllowedFileTypes="jpg,jpeg" ThrobberID="2" MaximumNumberOfFiles="10" ContextKeys="2" OnUploadComplete="ajaxUpload2_OnUploadComplete" runat="server" />