Re: Customize Images, Links, Code Snippet Dropdowns

  •  02-09-2004, 8:46 PM

    Re: Customize Images, Links, Code Snippet Dropdowns

    OK.

     

    You need to use the itemdatabound method for the datagrid. The ItemDataBound of the DataGrid occurs when data is bound to a item in a DataGrid control. This note explains how to use CuteEditor for .NET in the template control of a datagrid.

     

     

     

    <asp:Datagrid runat="server"

          Id="MyDataGrid"

          AutogenerateColumns="False"

          OnItemDataBound="onDataBound"           //

          OnEditcommand="MyDataGrid_EditCommand"

          OnCancelcommand="MyDataGrid_Cancel"

          OnUpdateCommand="MyDataGrid_UpdateCommand">

         <Columns>

                <asp:EditCommandColumn

                      ButtonType="LinkButton"

                      UpdateText= "Update"

                      CancelText="Cancel"

                      EditText="Edit"

                      ItemStyle-HorizontalAlign="Center"

                      HeaderText="Edit">

                </asp:EditCommandColumn>

                 <asp:BoundColumn

                      DataField="EmployeeID"

                      HeaderText="EmployeeID"

                      ReadOnly="True">

                </asp:BoundColumn>

                <asp:TemplateColumn HeaderText = "Title">

                       <ItemTemplate>

                          <%# DataBinder.Eval(Container.DataItem, "FirstName") %>

                       </ItemTemplate>

                       <EditItemTemplate>

                             <CE:Editor id = "FirstName_box"
                                     AutoConfigure="EnableAll" 

                                     DisableItemList="save"

                                     Text = '<%#DataBinder.Eval(Container.DataItem, "FirstName") %>'

                                     runat = "Server" >

                             </CE:Editor>

                      </EditItemTemplate>

                </asp:TemplateColumn>

           </Columns>

    </asp:DataGrid>

     

     

    Specify an event handler for the DataGrid's ItemDataBound.This event handler should be mapped to the OnItemDataBound property of the DataGrid control

     

     <script language="VB" runat="server">

            Sub onDataBound(sender as Object, e as DataGridItemEventArgs)

                  If e.Item.ItemType = ListItemType.EditItem Then

                        Dim txtFirstName As CuteEditor.Editor

                        txtFirstName = CType(e.Item.FindControl("FirstName_Box"), CuteEditor.Editor)

                        txtFirstName.StyleDropDown.Items.Add(new ListItem("Style 1","Heading"))

                        txtFirstName.StyleDropDown.Items.Add(new ListItem("Style 2","Head"))

                        txtFirstName.StyleDropDown.Items.Add(new ListItem("Style 3","Subhead"))

                        txtFirstName.StyleDropDown.Items.Add(new ListItem("Style 4","NormalRed"))

                        txtFirstName.StyleDropDown.Items.Add(new ListItem("Style 5","Comment"))

                  End If

             End Sub

    </script>

     

    If you have any further question, please let me know.

     

     


    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

View Complete Thread