Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 12th, 2007, 09:56 PM
Authorized User
 
Join Date: Oct 2006
Location: , , .
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default Selecting Text When Editing Datagrid

Hi,

I have an application that uses a datagrid with EDIT column. The program runs fine and I am able to edit the column of datagrid using the code :

 Datagrid1.EditItemIndex = E.Item.ItemIndex

The code works fine, however, I believe it would be more user friendly if I can make the data of the column to be selected automatcially when EDIT button is clicked. Because what happens in the application is, when you click EDIT button, the data will be displayed for editing, and you will have to click again the mouse to the textbox to edit the data. I would want the focus to go to the textbox automatically so that user can immediately enter new data.

Thanks so much in advance!


  #2 (permalink)  
Old May 29th, 2007, 04:58 PM
Registered User
 
Join Date: May 2007
Location: London, , United Kingdom.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to zak_willis
Default

Hi there. I won't be posting my code as it is probably over-excessive, but I can tell you how to solve this. The basic problem is that the asp.net 1.1 datagrid doesn't really come up to scratch. Yes, sure you can click an edit column and make it appear as a text box column but what you really want is to be able to have textboxes, checkboxes and dropdowns, you need to be able to create dynamic template columns. I don't think many people would not want to have some form of dynamism as opposed to setting the templates up manually.
For this you need to implement the Itemplate interface and use the Instantiate in method. This allows you to add a textbox, combobox, etc at runtime and set the value to the value of the databinder. A handler is then created that adds the relevant control to the datagridcell. The end result is a datagrid of editable text boxes etc.


Zak Willis
Managing Director of www.blue-rhino.co.uk
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Editing Datagrid toddw607 ASP.NET 2.0 Basics 5 April 26th, 2007 03:06 PM
Editing in DataGrid abdul_owiusa ASP.NET 1.0 and 1.1 Professional 0 May 1st, 2006 07:56 AM
insert text into a text box by selecting an link gavmc Other Programming Languages 0 February 15th, 2006 09:46 AM
Editing a Text File mh VB.NET 1 December 8th, 2005 02:37 AM
Editing text in a richtextbox ja8261 VB.NET 2002/2003 Basics 5 March 9th, 2005 04:10 PM



All times are GMT -4. The time now is 06:56 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.