Re: Multiple instances single page

  •  05-10-2008, 10:01 AM

    Re: Multiple instances single page

    Just answered my own question through experimenting. The following relates to a GridView control so the code behind is a bit more complex than would be the typical case. The code behind that I used for a simple ASP.NET Table control is listed toward the bottom of this post below the GridView code behind example.
     
     
    aspx markup (two text boxes):
     
    Box #1:

    <EditItemTemplate>

    <CE:Editor ID="CeName" runat="server" AutoConfigure="None" Text='<%# Eval("Name") %>'>

    </CE:Editor>

    </EditItemTemplate>

    Box #2:

    <EditItemTemplate>

    <CE:Editor ID="CeDescription" runat="server" AutoConfigure="Minimal" Text='<%# Eval("Description") %>'>

    </CE:Editor>

    </EditItemTemplate>

     
    Code behind:
     

    using CuteEditor;

     
    Box #1:

    string name = ((Editor)grid.Rows[e.RowIndex].FindControl("CeName")).Text;

     
    Box #2:
    string description = ((Editor)grid.Rows[e.RowIndex].FindControl("CeDescription")).Text;


    -----------------------------------------------------------------------
    Here is the code behind for the editor when used with an ASP.NET Table control (the aspx markup is the same except that it isn't enclosed in a template):

    // Get the values from the Cute Editor

    string newName = CeNewName.Text; // CeNewName is the ID for the particulat text box

    string newDescription = CeNewDescription.Text;

     
View Complete Thread