Tuesday, March 13, 2012

Switch between TextBox and Label inside DataGrid

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.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? :(
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" <john.smith@.microsoft.com> wrote in message
news:gcchg.3497$oj5.1152372@.news.siol.net...
> 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.
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" <john.smith@.microsoft.com> wrote in message
news:gcchg.3497$oj5.1152372@.news.siol.net...
> 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.
Thanks.

0 comments:

Post a Comment