473,396 Members | 1,891 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,396 software developers and data experts.

EditCommand on a Nested DataGrid...

Hi,

I have a datagrid nested inside another datagrid, the
edit/update/cancel command works fine on the outter datagrid but I'm
having problems with the inner one. There are 2 problems and here's
the code for my inner datagrid's EditCommand:

public void dgInner_EditCommand(object sender,
DataGridCommandEventArgs e)
{
dgInner = sender as DataGrid;
dgInner.EditItemIndex = e.Item.ItemIndex;
dgInner.DataSource = GetInnerGridData();
dgInner.DataBind();
}

If I rebind the data like above, the grid doesn't show any data
at all. And if I comment out the last two lines; i.e., without
rebinding, the datagrid remains the same until I click on the Edit
button the 2nd time then the Update and Cancel button shows and the
grid goes into the edit mode.

Here's my ASP code, I'd appreciate it if anyone could help.
Thanks.

<asp:DataGrid AutoGenerateColumns="false"
BorderColor="#cccccc"
BorderStyle="None"
BorderWidth="1"
CellPadding="3"
DataSource='<%# GetPrescriptions(DataBinder.Eval(Container.DataIte m,
"phar_order_no")) %>'
HeaderStyle-BackColor = "#4169E1"
HeaderStyle-Font-Name = "verdana"
HeaderStyle-Font-Size = "10px"
HeaderStyle-Font-Bold = "True"
HeaderStyle-ForeColor = "#FFFFFF"
id="dgInner"
OnEditCommand="dgInner_EditCommand"
OnCancelCommand="dgInner_CancelCommand"
runat="server"
Width="80%">
<AlternatingItemStyle Font-Size="XX-Small" Font-Names="Verdana"
ForeColor="DarkBlue" BackColor="AliceBlue"></AlternatingItemStyle>
<ItemStyle Font-Size="XX-Small" Font-Names="Verdana" Height="20px"
ForeColor="DarkBlue" BackColor="White"></ItemStyle>
<Columns>
<asp:TemplateColumn HeaderText="Column 1">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "c1") %>
</ItemTemplate>
</asp:TemplateColumn>

<asp:TemplateColumn HeaderText="Completed">
<ItemTemplate>
<asp:CheckBox ID="chkLineCompleted" Enabled="False" Checked='<%#
DataBinder.Eval(Container.DataItem, "completed") %>' runat="server" />
</ItemTemplate>
<EditItemTemplate>
<asp:CheckBox ID="edit_chkLineCompleted" Enabled="True" Checked='<%#
DataBinder.Eval(Container.DataItem, "completed") %>' Runat="server" />
</EditItemTemplate>
</asp:TemplateColumn>

<asp:TemplateColumn HeaderText="Action">
<itemtemplate>
<asp:imagebutton runat="server" CommandName="Edit"
ImageUrl="Images/icon_edit.gif" ID="Imagebutton1" AlternateText="Edit"
Height="12" Width="12" />&nbsp;<br>
</itemtemplate>
<edititemtemplate>
<asp:imagebutton runat="server" CommandName="Update"
ImageUrl="Images/icon_save.gif" ID="Imagebutton2"
AlternateText="Update" Height="12" Width="12" />&nbsp;&nbsp;
<asp:imagebutton runat="server" CommandName="Cancel"
ImageUrl="Images/icon_cancel.gif" ID="Imagebutton3"
AlternateText="Cancel" Height="12" Width="12" />&nbsp;<br>
</edititemtemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
Nov 18 '05 #1
0 1219

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

Similar topics

0
by: bmoman | last post by:
Hell I have a datagrid with an Edit, Update, Cancel button on it. When I click the edit button the first time, the EditCommand event is not fired, but when I click the same button immediately...
4
by: Richard Roche | last post by:
Is it possible to use a drop combo instead of a text box when using the EditCommand in the Datagrid? Many table columns are bound to 'lookup' tables, user's don't care about the foreign keys,...
0
by: Chad Folden | last post by:
I can't figure out how to use the EditCommand for the nested datagrid .. HELP PLEASE ;-) It works perfectly for the parent datagrid, but will not display, even though the EditCommand event is...
0
by: Mike | last post by:
I've got an app with a DataTable that gets passed around and modified by datagrids on 3 different asp.net pages. Not all columns need to be displayed, but I need them all in the datagrid so I can...
1
by: bill yeager | last post by:
I'm doing an inline edit of an Admin table using the Datagrid. There are three columns in my Admin table. I want to dynamically disable the corresponding "CareType" field (see below) in the grid...
1
by: jacobryce | last post by:
j9 (Programmer) Feb 15, 2005 I have a datagrid with an arraylist as the datasource. I added an Edit, Update, Cancel button column and coded the EditCommand event handler. When I click on the...
1
by: benoit | last post by:
Hi, I created a Dynamic Datagrid and i added an EditCommandColumn to it. Works fine, but my Editcommand eventhandler seems to have a problem with PostBack This is my code private DataGrid...
1
by: Joe | last post by:
Hello All: I have the understanding that the datagrid requires that ViewState be turned on in order to use the ItemCommand, EditCommand,SortCommand, etc event handlers. Does anyone know if this...
1
by: bill | last post by:
I have an update panel that contains a gridview. There are 2 triggers: one for a search button that is outside the panel and one for the gridview EditCommand Event. The search works fine, the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.