回发后获得价值 [英] Get Value After Postback Time
本文介绍了回发后获得价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨...
我使用One File上传,下拉列表和Button.But Droplist postback属性true我丢失fileupload值..参见此代码。解决方案ME。
< asp:ScriptManager ID = ScriptManager1 runat = 服务器 >
< / asp:ScriptManager >
< span class =code-keyword>< asp:UpdatePanel ID = UpdatePanel1 runat = server >
< 触发器 >
< asp:AsyncPostBackTrigger ControlID = DropDownList1 EventName = DropDownList1_SelectedIndexChanged / >
<% - < asp:PostBackTrigger ControlID = DropDownList1 /> - %>
< ; /触发器 >
< ContentTemplate >
< 表 class = style1 >
< tr >
< td >
< asp:FileUpload ID = FileUpload1 runat = server < span class =code-attribute> / >
< / td >
< td >
& nbsp;
< / td >
< td > ;
& nbsp;
< / td >
< < span class =code-leadattribute> / tr >
< tr >
< td >
< asp:DropDownList ID = DropDownList1 runat = server AutoPostBack = True OnSelectedIndexChanged = < span class =code-keyword> DropDownList1_SelectedIndexChanged >
< asp:ListItem > 选择< / asp:ListItem >
< asp:ListItem > 1 < / asp:ListItem >
< asp:ListItem > 2 < / asp:ListItem >
< ; / asp:DropDownList >
< / td >
< td >
< span class =code-keyword>< asp:TextBox ID = TextBox1 runat = server > < / asp:TextBox >
< / td >
< td >
& nbsp;
< / td >
< / tr >
< tr >
< td >
< asp:按钮 ID = Button1 runat = server OnClick = Button1_Click 文本 = 按钮 < span class =code-attribute> / >
< / td >
< td >
& nbsp;
< / td >
< td >
& nbsp;
< / td >
< / tr >
< / table >
< / ContentTemplate >
< / asp:UpdatePanel >
解决方案
你不能保留fileupload控件的值,一旦重新加载页面,它将丢失文件名。
< 触发器 >
< asp:PostBackTrigger ControlID = DropDownList1 / >
< span class =code-keyword>< / Triggers >
Hi...
I have use One File upload , Dropdown list and Button.But Droplist postback propertiy true i loss fileupload value..See this code.And Solution ME.
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="DropDownList1" EventName ="DropDownList1_SelectedIndexChanged" />
<%--<asp:PostBackTrigger ControlID ="DropDownList1" />--%>
</Triggers>
<ContentTemplate>
<table class="style1">
<tr>
<td>
<asp:FileUpload ID="FileUpload1" runat="server" />
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem>Select</asp:ListItem>
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
</asp:DropDownList>
</td>
<td>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
<td>
</td>
</tr>
<tr>
<td>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
</td>
<td>
</td>
<td>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
解决方案
you can not retain the value of fileupload control, once the page is reloaded it will lose the file name.
<Triggers> <asp:PostBackTrigger ControlID ="DropDownList1" /> </Triggers>
这篇关于回发后获得价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文