Re: Can I create new Category

  •  11-30-2010, 9:42 PM

    Re: Can I create new Category

    Hi raneamey,
     
    Please try the example below
     
    1. <%@ Page Language="C#" %>  
    2.   
    3. <%@ Register TagPrefix="DotNetGallery" Namespace="DotNetGallery" Assembly="DotNetGallery" %>  
    4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
    5.   
    6. <script runat="server">  
    7.    
    8.     protected void btnCreate_Click(object sender, EventArgs e)  
    9.     {  
    10.         using (DotNetGallery.GalleryDataProvider provider = DotNetGallery.GalleryDataProvider.CreateInstance(Context, "~/GalleryFiles/"))  
    11.         {  
    12.             provider.CreateCategory(tbName.Text, tbDescription.Text, "");  
    13.   
    14.         }  
    15.   
    16.     }  
    17. </script>  
    18.   
    19. <html xmlns="http://www.w3.org/1999/xhtml">  
    20. <head runat="server">  
    21.     <title>Untitled Page</title>  
    22. </head>  
    23. <body>  
    24.     <form id="form1" runat="server">  
    25.         <div>  
    26.             <table>  
    27.                 <tr>  
    28.                     <td>  
    29.                         Category Name:  
    30.                     </td>  
    31.                     <td>  
    32.                         <asp:TextBox ID="tbName" runat="server"></asp:TextBox>  
    33.                     </td>  
    34.                 </tr>  
    35.                 <tr>  
    36.                     <td>  
    37.                         Category descriptioin:  
    38.                     </td>  
    39.                     <td>  
    40.                         <asp:TextBox runat="server" ID="tbDescription"></asp:TextBox>  
    41.                     </td>  
    42.                 </tr>  
    43.             </table>  
    44.             <asp:Button ID="btnCreate" runat="server" Text="Create Category" OnClick="btnCreate_Click" />  
    45.             <DotNetGallery:GalleryBrowser ID="galleryBrowser1" runat="server" AllowEdit="true" />  
    46.         </div>  
    47.     </form>  
    48. </body>  
    49. </html> 

     
    Regards,
     
    ken
View Complete Thread