我有下拉列表我想在单击选定的更改索引后选择值SELECT文件 调用
<asp:DropDownList ID="pdfdropdown" runat="server" AutoPostBack="true" OnSelectedIndexChanged="pdfdropdown_SelectedIndexChanged">
<asp:ListItem Value="-1">Select file</asp:ListItem>
<asp:ListItem Value="open">download excel</asp:ListItem>
<asp:ListItem Value="download">dowload pdf</asp:ListItem>
</asp:DropDownList>
protected void pdfdropdown_SelectedIndexChanged(object sender, EventArgs e)
{
pdfdropdown.SelectedValue = "-1";
Response.AppendHeader("Content-Disposition", "attachment; filename=" + name + ".pdf");
//......funtions script
}
但是当我下载文件时我很奇怪。未选择所选值。(下载后)如何更改下拉列表值
答案 0 :(得分:0)
试试这个
pdfdropdown.Items.FindByValue("-1").Selected = true;