Switch between TextBox and Label inside DataGrid

Discussion in 'ASP .Net' started by John Smith, Jun 6, 2006.

  1. John Smith

    John Smith Guest

    I have DataGrid with Label in one of its columns. Label should change into
    TextBox, when user do some specific action. How can I acomplish this??


    P.S. Sorry for multiple posts in the same newsgroup, but I had to do that,
    because my OE news reader doesn't show all my posts.
     
    John Smith, Jun 6, 2006
    #1
    1. Advertising

  2. John Smith

    John Smith Guest

    I'm trying this:

    <asp:TemplateColumn HeaderText="Sum">
    <ItemTemplate>
    <asp:Label id="lblSum" runat="server" Text='<%#
    Container.DataItem("Sum") %>'>
    </asp:Label>
    </ItemTemplate>
    <EditItemTemplate>
    <asp:TextBox id="txtSum" runat="server" Text='<%#
    Container.DataItem("Sum") %>'>
    </asp:TextBox>
    </EditItemTemplate>
    </asp:TemplateColumn>

    but when I do this:

    DataGrid1.EditItemIndex = index

    all DataGrid fields in selected row becomes editable and I wan't only one
    specific field to be editable (TextBox). What should I do? :(
     
    John Smith, Jun 6, 2006
    #2
    1. Advertising

  3. You need to make an ItemTemplate including both the label and the textbox
    and control their visibility depending
    on user actions. For an experienced javascript programmer I would recommend
    doing it on client side. Otherwise you can do it on server side, possibly
    with AJAX or other similar technologies.

    Eliyahu


    "John Smith" <> wrote in message
    news:gcchg.3497$...
    >
    > I have DataGrid with Label in one of its columns. Label should change into
    > TextBox, when user do some specific action. How can I acomplish this??
    >
    >
    > P.S. Sorry for multiple posts in the same newsgroup, but I had to do that,
    > because my OE news reader doesn't show all my posts.
    >
     
    Eliyahu Goldin, Jun 6, 2006
    #3
  4. John Smith

    sharmil Guest

    Hi,

    I think you want to edit values by switching between label and textbox. The
    following link would be very helpful.

    http://www.syncfusion.com/FAQ/aspnet/WEB_c4c.aspx#q391q

    Thanks
    Sharmila



    "John Smith" <> wrote in message
    news:gcchg.3497$...
    >
    > I have DataGrid with Label in one of its columns. Label should change into
    > TextBox, when user do some specific action. How can I acomplish this??
    >
    >
    > P.S. Sorry for multiple posts in the same newsgroup, but I had to do that,
    > because my OE news reader doesn't show all my posts.
    >
     
    sharmil, Jun 19, 2006
    #4
  5. John Smith

    John Smith Guest

    Thanks.
     
    John Smith, Jun 27, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. , India
    Replies:
    14
    Views:
    674
    James Kanze
    Jun 18, 2007
  2. Replies:
    10
    Views:
    749
  3. Ashish Bandi via .NET 247

    Accessing TextBox/Label controls inside a Repeater control

    Ashish Bandi via .NET 247, May 14, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    841
    Scott Mitchell [MVP]
    May 14, 2004
  4. Switch Within A Switch

    , Apr 22, 2006, in forum: Javascript
    Replies:
    7
    Views:
    129
    Lasse Reichstein Nielsen
    Apr 22, 2006
  5. Knut Krueger
    Replies:
    8
    Views:
    336
    Knut Krueger
    Aug 20, 2013
Loading...

Share This Page