<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="TestFileUpload.aspx.vb" Inherits="Maint_TestFileUpload" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> <asp:Button ID="btnInsertNew" runat="server" style=" font: comics sans ms; margin-bottom: 10px" Text="Insert New Image" /> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <contenttemplate> <asp:ListView ID="lvwPics" runat="server" DataSourceid="sdsPics" DataKeyNames="PictureId" InsertItemPosition="None"> <layouttemplate> <table ID="itemPlaceholderContainer" runat="server" style="border: solid 1px; width: 100%"> <thead> <tr id="Tr1" runat="server" class="lvwBasketHdr" > <td id="Td1" align="center" runat="server" > <asp:Label ID="Label1" runat="server" Text="Title / Image"/> <td id="Td2" align="center" runat="server"> <asp:Label ID="Label2" runat="server" Text="Data Item"/> <td id="Td4" align="center" runat="server"> <asp:Label ID="Label3" runat="server" Text="Value"/> <td id="Td5" align="center" runat="server"> <asp:Label ID="Label4" runat="server" Text="Action"/> </thead> <tbody> <tr runat="server" id="itemPlaceholder" > </tbody> </layouttemplate> <itemtemplate> <tr style="width:100%"> <td id="Td3" valign="top" align="center" style="width:25%" rowspan="1"> <asp:Label ID="Label5" runat="server" CssClass="SmallTitle" Text='<% #Eval("Title")%>'> <br /> <asp:HyperLink ID="HyperLink2" runat="server" ImageUrl='<%#Eval("ThumbnailPath")%>' NavigateUrl='<%#Eval("PictureURL")%>' ToolTip="Double click to enlarge image"> <asp:Label ID="Label6" runat="server" Visible="false" Text='<%#Eval("PictureId")%>'/> </td> <td style="height: 1.2em"> </td> <td style="height: 1.2em"> </td> <td align="center" rowspan="1" style="width:10%"> <asp:Button ID="btnRemove" CommandName="DELETE" runat="server" Text="Remove" CssClass="btnAction" CausesValidation="False" /> <asp:Button ID="btnEdit" CommandName="EDIT" runat="server" Text="Edit" CssClass="btnAction" CausesValidation="False" /> </td> </tr></itemtemplate> <itemseparatortemplate> <td colspan="4" style="border-removedsolid 1px silver"> </td> </itemseparatortemplate> <edititemtemplate> <asp:UpdatePanel ID="UpdatePanel3" runat="server"> <triggers> <asp:PostBackTrigger ControlID="btnUpdate" /> </triggers> <contenttemplate> <tr style="width:100%"> <td id="Td3" valign="top" align="center" style="width:25%" rowspan="1"> <asp:Label ID="lblEditTitle" runat="server" CssClass="SmallTitle" Text='<% #Eval("Title")%>'> <asp:HyperLink ID="HyperLink2" runat="server" ImageUrl='<%#Eval("ThumbnailPath")%>' NavigateUrl='<%#Eval("PictureURL")%>' ToolTip="Double click to enlarge image"> <asp:Label ID="lblEditPicId" runat="server" Visible="false" Text='<%#Eval("PictureId")%>'/> </td> <td class="PicMaintLabel" valign="top" style="width:15%"> <asp:Label ID="lblChangeImage" runat="server" Text="Change Image :"/> </td> <td style="width:50%" onmouseover="this.style.backgroundColor='#FBF5E6'" önmouseout="this.style.backgroundColor='#FFFFFF'"> <asp:FileUpload id="fuEditImage" runat="server" > </td> <td align="center" rowspan="1" style="width:10%"> <asp:Button ID="btnUpdate" CommandName="UPDATE" runat="server" Text="Update" CssClass="btnAction" ValidationGroup="Edit" /> <asp:Button ID="btnCancelEdit" CommandName="CANCEL" runat="server" Text="Cancel" CssClass="btnAction" CausesValidation="False" /> </td> </tr> </contenttemplate> </edititemtemplate> <asp:SqlDataSource ID="sdsPics" runat="server" ConnectionString="<%$ ConnectionStrings:cnAA %>" SelectCommand="SELECT * FROM vwMaintPics " DeleteCommand="DELETE FROM Pictures WHERE PictureId = @PictureId " UpdateCommand="UPDATE Pictures SET Title = @Title WHERE PictureId = @PictureId" > </contenttemplate>
Protected Sub lvwPics_ItemUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ListViewUpdateEventArgs) Handles lvwPics.ItemUpdating Try mfu = CType(lvwPics.EditItem.FindControl("fuEditImage"), FileUpload) e.NewValues.Add("PictureId", CType(lvwPics.EditItem.FindControl("lblEditPicId"), Label).Text) e.NewValues.Add("Title", mfu.FileName) Catch ex As Exception End Try End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)