Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > HowTo: DataGrid edit mode for template columns?

Reply
Thread Tools

HowTo: DataGrid edit mode for template columns?

 
 
Alex
Guest
Posts: n/a
 
      04-25-2004
I'm using a DataGrid with several bound columns. However for one column I
had to use a ItemTemplate with a asp:hyperlink in it.
How can I switch the hyperlink column into the edit mode in the datagrid
event handler?

Also, I sit possible to make not allow a field to be edited from within the
edit handler?


 
Reply With Quote
 
 
 
 
Scott Mitchell [MVP]
Guest
Posts: n/a
 
      04-26-2004
Alex wrote:
> I'm using a DataGrid with several bound columns. However for one column I
> had to use a ItemTemplate with a asp:hyperlink in it.
> How can I switch the hyperlink column into the edit mode in the datagrid
> event handler?


You need to provide an EditItemTemplate in the TemplateColumn.

<asp:TemplateColumn>
<ItemTemplate>
<asp:HyperLink ... />
</ItemTEmplate>
<EditItemTemplate>
<asp:TextBox runat="Server" id="txtLinkEdit" Text='<%#
DataBinder.Eval(Container.DataItem, "hyperlinkFieldName")' />
</EditItemTemplate>
</asp:TemplateColumn>


To learn how to read the value of the edited TemplateColumn
programmatically, see:
http://datawebcontrols.com/faqs/Prog...Contents.shtml

Happy Programming!

--

Scott Mitchell

http://www.4GuysFromRolla.com
http://www.ASPFAQs.com
http://www.ASPMessageboard.com

* When you think ASP, think 4GuysFromRolla.com!
 
Reply With Quote
 
 
 
 
Alex
Guest
Posts: n/a
 
      04-26-2004
Thanks, works great!

"Scott Mitchell [MVP]" <> wrote in message
news:kq1jc.41203$. com...
> Alex wrote:
> > I'm using a DataGrid with several bound columns. However for one column

I
> > had to use a ItemTemplate with a asp:hyperlink in it.
> > How can I switch the hyperlink column into the edit mode in the datagrid
> > event handler?

>
> You need to provide an EditItemTemplate in the TemplateColumn.
>
> <asp:TemplateColumn>
> <ItemTemplate>
> <asp:HyperLink ... />
> </ItemTEmplate>
> <EditItemTemplate>
> <asp:TextBox runat="Server" id="txtLinkEdit" Text='<%#
> DataBinder.Eval(Container.DataItem, "hyperlinkFieldName")' />
> </EditItemTemplate>
> </asp:TemplateColumn>
>
>
> To learn how to read the value of the edited TemplateColumn
> programmatically, see:
>

http://datawebcontrols.com/faqs/Prog...Contents.shtml
>
> Happy Programming!
>
> --
>
> Scott Mitchell
>
> http://www.4GuysFromRolla.com
> http://www.ASPFAQs.com
> http://www.ASPMessageboard.com
>
> * When you think ASP, think 4GuysFromRolla.com!



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GridView control enters edit mode when I click Edit link twice Jaime Stuardo ASP .Net Web Controls 0 04-07-2006 12:47 AM
Snapshot restraint - edit, edit, edit Alan Browne Digital Photography 24 05-10-2005 10:15 PM
Snapshot restraint - edit, edit, edit Patrick Digital Photography 0 05-06-2005 10:53 PM
Would like to load a datagrid already in edit mode instead of having the user click the edit button Frank Kurka ASP .Net Datagrid Control 8 04-29-2005 09:33 AM
Edit All Function for DataGrid, and Moving the Edit Function in a DataGrid Schultz ASP .Net 3 02-14-2005 04:47 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57