|
-
February 1st, 2005, 04:05 AM
#1
can I put EditCommandColumn within table tags?
can I put EditCommandColumn within table tags?
I am displaying a datagrid, but in a form style so that the user can edit the one record that they are looking at. I am using table tags within a template column to achieve this. I then want to add an EditCommandColumn to allow editing. Can I have this column displaying in the centre of the screen, below my template column. At the moment I can only get it to display to the right as it won't allow for table tags?
-
February 1st, 2005, 10:30 AM
#2
Re: can I put EditCommandColumn within table tags?
Yes and no.
You can't really put an EditCommandColumn in the middle of another column's ItemTemplate but you can accomplish what you are wanting pretty easily. Simply put a regular asp.net button wherever you want your edit button to be in your table, and on the button set the CommandName property to "Edit". This will trigger the EditCommand for the datagrid just like an EditCommandColumn would.
-
February 1st, 2005, 10:51 AM
#3
Re: can I put EditCommandColumn within table tags?
Cheers, i'll give it a try
-
February 1st, 2005, 11:41 AM
#4
Re: can I put EditCommandColumn within table tags?
Your solution works well. Can I get the "Edit" to run on the page load event as well, so that I could just have an update and cancel button?
-
February 1st, 2005, 11:52 AM
#5
Re: can I put EditCommandColumn within table tags?
Yes, you can...but how you go about doing it kinda depends on how you have the page setup and what exactly you are looking for. You could put all of your editable controls (textboxes, etc) in the datagrid ItemTemplate, rather than the EditItemTemplate (if they are there now). Then in your ItemTemplate you can create buttons just like the Edit one above except for Update and Cancel by assigning "Update" and "Cancel" to the CommandName tag.
Does your datagrid have more than 1 row? It sort of sounds from your description like you are just displaying a single record. Anyhow, if you have multiple rows and just want 1 to be editable on page load, you can effectively 'run' the edit command on page load by simply setting the datagrids selectedIndex property to the index of the record you want to edit (0 for the first one) before you bind the datagrid.
If neither of these solutions work for you, write back with some more details on how you got you page setup. Good luck!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|