trySplit
以上是我的网页表单的代码。此webform页面继承了我的母版页,其中包含另一个表单标记。 我在页面中弹出窗口以提示用户更新他们的数据。
<div style="width: 90%; margin-right: 5%; margin-left: 5%; text-align:center">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:GridView ID="GridView4" runat="server" AutoGenerateColumns="False"
DataKeyNames="immersionID" GridLines="Horizontal"
OnRowCommand="GridView4Data_RowCommand" onpageindexchanging="GridView4_PageIndexChanging" AllowPaging="true">
<Columns>
<asp:ButtonField CommandName="editRecord" ControlStyle-CssClass="btn"
ButtonType="Button" Text="Edit" HeaderText="Edit Record">
<ControlStyle CssClass="btn"></ControlStyle>
</asp:ButtonField>
<asp:BoundField DataField="immersionID" HeaderText="Immersion ID"
SortExpression="immersionID" />
<asp:BoundField DataField="immersionName" HeaderText="Immersion Name"
SortExpression="immersionName" />
<asp:BoundField DataField="startDate" HeaderText="Start Date"
SortExpression="startDate" />
<asp:BoundField DataField="endDate" HeaderText="End Date " />
<asp:BoundField DataField="noOfParticipants" HeaderText="No Of Participants" />
<asp:BoundField DataField="FName" HeaderText="File Name" />
<asp:TemplateField HeaderText="Download Link"
ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:LinkButton ID="lnkDownload2" runat="server"
CommandArgument='<%# Eval("immersionID") %>' OnClick="DownloadFile4"
Text="Download"></asp:LinkButton>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Image1" ItemStyle-Height="150"
ItemStyle-Width="170">
<EditItemTemplate>
<asp:TextBox ID="TextBox12" runat="server" Text='<%# Eval("ITimage") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Image ID="Image10" runat="server"
ImageUrl='<%# Eval("ITimage", GetUrl("{0}")) %>' />
</ItemTemplate>
<ControlStyle Height="170px" Width="150px" />
<ItemStyle Height="170px" Width="150px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Image2">
<EditItemTemplate>
<asp:TextBox ID="TextBox13" runat="server" Text='<%# Eval("ITimage2") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Image ID="Image11" runat="server"
ImageUrl='<%# Eval("ITimage2", GetUrl("{0}")) %>' />
</ItemTemplate>
<ControlStyle Height="170px" Width="150px" />
<ItemStyle Height="170px" Width="150px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Image3">
<EditItemTemplate>
<asp:TextBox ID="TextBox14" runat="server" Text='<%# Eval("ITimage3") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Image ID="Image12" runat="server"
ImageUrl='<%# Eval("ITimage3", GetUrl("{0}")) %>' />
</ItemTemplate>
<ControlStyle Height="170px" Width="150px" />
<ItemStyle Height="170px" Width="150px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Image4" SortExpression="ITimage4">
<EditItemTemplate>
<asp:TextBox ID="TextBox3" runat="server" Text='<%# Eval("ITimage4") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Image ID="Image3" runat="server" ImageUrl='<%# Eval("ITimage4", GetUrl("{0}")) %>' />
</ItemTemplate>
<ControlStyle Height="170px" Width="150px" />
<ItemStyle Height="170px" Width="150px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Image5" SortExpression="ITimage5">
<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Eval("ITimage5") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Image ID="Image2" runat="server" ImageUrl='<%# Eval("ITimage5", GetUrl("{0}")) %>' />
</ItemTemplate>
<ControlStyle Height="170px" Width="150px" />
<ItemStyle Height="170px" Width="150px" />
</asp:TemplateField>
</Columns>
<PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Right" />
<EmptyDataTemplate>
<asp:Label ID="Label29" runat="server" ForeColor="Red" Text="No Record Found"></asp:Label>
</EmptyDataTemplate>
<SelectedRowStyle BackColor="#FFFFCC" Font-Bold="True" ForeColor="Black" />
<HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" ForeColor="#000000" />
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
<div id="editModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="editModalLabel" aria-hidden="true">
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<table width="100%" style="width: 100%; height: 100%;" cellpadding="0" cellspacing="5">
<tr>
<td colspan="2" style="color:Black;"
align="center">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>Details</h3>
</div>
</td>
</tr>
<tr>
<td colspan="2" style="width: 45%; text-align: center;">
<asp:Label ID="LabelValidate" runat="server" />
</td>
</tr>
<tr>
<td align="right" style="width: 45%">
Immersion ID:
</td>
<td>
<asp:Label ID="lblID" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="right" style="width: 45%">
Immersion Name:
</td>
<td>
<asp:TextBox ID="TBName" runat="server" />
</td>
</tr>
<tr>
<td align="right">
Immersion Description:
</td>
<td>
<asp:TextBox ID="TBDesc" runat="server" TextMode="MultiLine"/>
</td>
</tr>
<tr>
<td align="right">
Immersion Location:
</td>
<td>
<asp:TextBox ID="TBLocation" runat="server" />
</td>
</tr>
<tr>
<td align="right">
Immersion Country:
</td>
<td>
<asp:TextBox ID="TBCountry" runat="server" />
</td>
</tr>
<tr>
<td align="right">
Category:
</td>
<td>
<asp:DropDownList ID="TBCat" runat="server">
<asp:ListItem>Select a Category</asp:ListItem>
<asp:ListItem>Category A</asp:ListItem>
<asp:ListItem>Category B</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td align="right">
No. Of Participants:
</td>
<td>
<asp:TextBox ID="TBNumber" runat="server" />
</td>
</tr>
<tr>
<td align="right">
Start Date:
</td>
<td>
<asp:TextBox ID="TBStart" runat="server" type="date"/>
</td>
</tr>
<tr>
<td align="right">
End Date:
</td>
<td>
<asp:TextBox ID="TBEnd" runat="server" type="date"/>
</td>
</tr>
<tr>
<td align="right">
Remarks:
</td>
<td>
<asp:TextBox ID="TBRemarks" runat="server" TextMode="MultiLine"/>
</td>
</tr>
<tr>
<td align="right">
Submitted By:
</td>
<td>
<asp:Label ID="TBSubmit" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
Diploma:
</td>
<td>
<asp:TextBox ID="TBDip" runat="server" />
</td>
</tr>
<tr>
<td class="style10">
Attachment:</td>
<td class="style11">
<asp:FileUpload ID="FileUpload19" runat="server" AllowMultiple="true"/>
</td>
</tr>
<tr>
<td class="style10">
Image 1: </td>
<td class="style11">
<asp:FileUpload ID="FileUpload20" runat="server" />
</td>
</tr>
<tr>
<td class="style10">
Image 2: </td>
<td class="style11">
<asp:FileUpload ID="FileUpload21" runat="server" />
</td>
</tr>
<tr>
<td class="style10">
Image 3: </td>
<td class="style11">
<asp:FileUpload ID="FileUpload22" runat="server" />
</td>
</tr>
<tr>
<td class="style10">
Image 4: </td>
<td class="style11">
<asp:FileUpload ID="FileUpload23" runat="server" />
</td>
</tr>
<tr>
<td class="style10">
Image 5: </td>
<td class="style11">
<asp:FileUpload ID="FileUpload24" runat="server" />
</td>
</tr>
</table>
<div class="modal-footer">
<asp:Label ID="Label1" Visible="false" runat="server"></asp:Label>
<asp:Button ID="btnUpdate" class="btn" CommandName="Update" runat="server" Text="Update" OnClick="btnUpdate_Click" />
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="GridView4" EventName="RowCommand" />
<asp:AsyncPostBackTrigger ControlID="btnUpdate" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</div>
</div>
上面是我将代码上传到我的数据库的代码隐藏。
*所有其他字段都可以更新,例如日期和事件名称等
单击上传按钮时没有任何错误,我已经尝试过调试它,显然它会跳过所有上传方法,即使我在每个字段中选择了一个文件。
所以问题是我无法将图像上传到数据库中。请帮忙解决这个问题,非常感谢帮助。谢谢!