473,385 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Edit in DataGrid

DC
Newbie's question about .NET datagrid
If I use:
<asp:EditCommandColumn></asp:EditCommandColumn>
When I edit a row, it will automatically show Update and Cancel Link.

But when I use:
<asp:Button id="btnEdit" runat="server" Text="Edit" CommandName="Edit"
CssClass="clickable"Width="50px" />

When I edit a row, the Update/Cancel links don't show up.

Can someone help me?

This is my code:
<asp:TemplateColumn HeaderText="Action" ItemStyle-Width="120px">
<ItemTemplate>
<asp:Button id="btnEdit" runat="server" Text="Edit"
CommandName="Edit" CssClass="clickable"
Width="50px" />
<asp:Button id="btnDelete" runat="server" Text="Delete"
CommandName="Delete" CssClass="clickable"
Width="50px" />
</ItemTemplate>
</asp:TemplateColumn>
- DC
Nov 18 '05 #1
4 4383
Jos
DC wrote:
Newbie's question about .NET datagrid
If I use:
<asp:EditCommandColumn></asp:EditCommandColumn>
When I edit a row, it will automatically show Update and Cancel Link.

But when I use:
<asp:Button id="btnEdit" runat="server" Text="Edit" CommandName="Edit"
CssClass="clickable"Width="50px" />

When I edit a row, the Update/Cancel links don't show up.

Can someone help me?

This is my code:
<asp:TemplateColumn HeaderText="Action" ItemStyle-Width="120px">
<ItemTemplate>
<asp:Button id="btnEdit" runat="server" Text="Edit"
CommandName="Edit" CssClass="clickable"
Width="50px" />
<asp:Button id="btnDelete" runat="server" Text="Delete"
CommandName="Delete" CssClass="clickable"
Width="50px" />
</ItemTemplate>
</asp:TemplateColumn>


Put the Update and Delete buttons in an EditItemTemplate, not
in an ItemTemplate.

--

Jos
Nov 18 '05 #2
DC
>
Put the Update and Delete buttons in an EditItemTemplate, not
in an ItemTemplate.

--

Jos

Something like this?
<asp:TemplateColumn SortExpression="" HeaderText="Action">
<EditItemTemplate>
<asp:Button id="btnEdit" runat="server" Text="Edit"
CommandName="Edit" CssClass="clickable"
Width="50px" />
<asp:Button id="btnDelete" runat="server" Text="Delete"
CommandName="Delete" CssClass="clickable"
Width="50px" />

</EditItemTemplate>
</asp:TemplateColumn>

The column shows nothing, no buttons at all.
What am I missing?
Nov 18 '05 #3
Jos
DC wrote:
Put the Update and Delete buttons in an EditItemTemplate, not
in an ItemTemplate.

--

Jos

Something like this?
<asp:TemplateColumn SortExpression="" HeaderText="Action">
<EditItemTemplate>
<asp:Button id="btnEdit" runat="server" Text="Edit"
CommandName="Edit" CssClass="clickable"
Width="50px" />
<asp:Button id="btnDelete" runat="server" Text="Delete"
CommandName="Delete" CssClass="clickable"
Width="50px" />

</EditItemTemplate>
</asp:TemplateColumn>

The column shows nothing, no buttons at all.
What am I missing?


Dit you handle the EditCommand event on the datagrid?

Something like this:
Sub DataGrid1_OnEditCommand(Sender As Object, E As DataGridCommandEventArgs)
DataGrid1.EditItemIndex = e.Item.ItemIndex
BindGrid()
End Sub

and:

<asp:DataGrid id="DataGrid1" OnEditCommand="DataGrid1_OnEditCommand"
runat="server">

--

Jos Branders
Nov 18 '05 #4
Hello,
<asp:editCommandColumn> is in-build feature. So, when you use
this, on edit, you will get other two buttons. If you use
<asp:button>, you will not get buttons for update&calcel. So, you have
to write code on your own for this. <asp:button> is a web control for
buttons to submit pages to server. Similary you can use this for
"Edit", but for update&cancle, you have to write code on your own.

I hope this will help you.

-Sri.

"DC" <dc*******@email.com> wrote in message news:<OK**************@tk2msftngp13.phx.gbl>...
Newbie's question about .NET datagrid
If I use:
<asp:EditCommandColumn></asp:EditCommandColumn>
When I edit a row, it will automatically show Update and Cancel Link.

But when I use:
<asp:Button id="btnEdit" runat="server" Text="Edit" CommandName="Edit"
CssClass="clickable"Width="50px" />

When I edit a row, the Update/Cancel links don't show up.

Can someone help me?

This is my code:
<asp:TemplateColumn HeaderText="Action" ItemStyle-Width="120px">
<ItemTemplate>
<asp:Button id="btnEdit" runat="server" Text="Edit"
CommandName="Edit" CssClass="clickable"
Width="50px" />
<asp:Button id="btnDelete" runat="server" Text="Delete"
CommandName="Delete" CssClass="clickable"
Width="50px" />
</ItemTemplate>
</asp:TemplateColumn>
- DC

Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Tamir Khason | last post by:
How to prevent the selected cell from being editable (visual) at DataGrid? Once click on cell (even readonly) there are cursor inside it and select text appears. How to prevent it Thankx
0
by: San Diego Guy | last post by:
Hi all! I have Datagrid. Within that datagrid I have a drop down list that I set up some values in (a "collection") I set up an edit command column on the datagrid and wrote simple code to get...
2
by: Sky | last post by:
Hello: Another question about trying to wring functionality from a DataGrid... Have a DB table of "Contacts" -- 14 or more fields per record Show in datagrid -- but only 5 columns (First,Last,...
0
by: Steve Kallal | last post by:
I have a DataGrid with an EditCommandColumn column set to a type of PushButton. I want to set set CssClass on these buttons and cannot without using code-behind code on the ItemDataBound event. The...
3
by: Leo | last post by:
I have a datagrid with the first column as a Edit,Update,Cancel button column. The other 5 columns are template columns. When I click the Edit button in IE6 the row correctly displays the...
3
by: Tim::.. | last post by:
Can someone please tell me how I go about preselecting an item in a drop drown list when I click the Edit Command in a datagrid? I have tried the following but it doesn't work for me! I would...
3
by: Schultz | last post by:
is there an easy to follow, source code in one document, article that explains how to create an edit all DataGrid control? and, I have a DataGrid setup where the client enters information for...
1
by: David Sagenaut | last post by:
Can I set a whole datagrid in edit mode, like a table? I can edit the data in the datagrid. After done, I can click the save button to save the data into a datasousce. I don't want to used the...
9
by: rn5a | last post by:
A Form has a DataGrid which displays records from a SQL Server 2005 DB table. Users can modify the records using this DataGrid for which I am using EditCommandColumn in the DataGrid. This is the...
8
by: =?Utf-8?B?bWlrZWc=?= | last post by:
Hi, I am building a small Help Desk application for my company and need to be able to edit "open" help desk issues. I use a simple datagrid to display each issue (6 per page) , with an Edit...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.