如何在ASP.NET Web窗体中的UpdatePanel内的GridView内使用FileUpload而无需回发

时间:2019-05-27 16:37:30

标签: c# asp.net ajax webforms updatepanel

我正在尝试在UpdatePanel内的GridView中使用FileUpload控件,但没有完整的回发

我尝试放置触发器,但是它使回发或fileupload为空

我搜索了很多,但没有找到可以解决我问题的结果。

我使用了asyncpostback触发器,但我发现文件上传仍然相同

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <data:EntityGridView ID="GridView1" runat="server"
            AutoGenerateColumns="False"
            OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
            DataSourceID="SiteConfigDataSource"
            DataKeyNames="Id"
            AllowMultiColumnSorting="false"
            DefaultSortColumnName=""
            DefaultSortDirection="Ascending"
            OnRowUpdating="GridView1_RowUpdating">
            <Columns>



                <asp:TemplateField HeaderText="Value" SortExpression="[value]">
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("Value") %>' Visible='<%# int.Parse(Eval("ID").ToString())>120 && int.Parse(Eval("ID").ToString())<161 ? Convert.ToBoolean(1) : Convert.ToBoolean(0) %>'></asp:Label>
                        <asp:Image ID="Image1" runat="server" ImageUrl='<%# Bind("Value") %>' Visible='<%# int.Parse(Eval("ID").ToString())>200 ? Convert.ToBoolean(1) : Convert.ToBoolean(0) %>' />
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Value") %>' Visible='<%# int.Parse(Eval("ID").ToString())>120 && int.Parse(Eval("ID").ToString())<161 ? Convert.ToBoolean(1) : Convert.ToBoolean(0) %>'></asp:TextBox>
                        <asp:FileUpload ID="FileUpload1" runat="server" Visible='<%# int.Parse(Eval("ID").ToString())>200 %>' />


                    </EditItemTemplate>
                </asp:TemplateField>


                <asp:TemplateField ShowHeader="False">
                    <ItemTemplate>
                        <asp:ImageButton ImageUrl="~/Images/iconfinder_file_edit_48763_quick.png" Width="25" Height="25" ID="LinkButtonEdit" runat="server" CausesValidation="False"
                            CommandName="Edit" data-toggle="tooltip" data-placement="top" title="Quick Edit" />

                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:ImageButton ImageUrl="~/Images/iconfinder_notification_done_48784.png" Width="25" Height="25" ID="LinkButtonUpdate" runat="server" CausesValidation="True"
                            CommandName="Update" data-toggle="tooltip" data-placement="top" title="Save Changes" />
                        <asp:ImageButton ImageUrl="~/Images/iconfinder_notification_remove_48786.png" Width="25" Height="25" ID="LinkButtonCancel" runat="server" CausesValidation="False"
                            CommandName="Cancel" data-toggle="tooltip" data-placement="top" title="Cancel Changes" />
                    </EditItemTemplate>
                </asp:TemplateField>
            </Columns>
            <EmptyDataTemplate>
                <b>No SiteConfig Found!</b>
            </EmptyDataTemplate>
        </data:EntityGridView>

    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="GridView1" EventName="RowUpdating" />

    </Triggers>

</asp:UpdatePanel>

0 个答案:

没有答案