473,671 Members | 2,248 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_EditCom mand(object sender,
DataGridCommand EventArgs e)
{
dgInner = sender as DataGrid;
dgInner.EditIte mIndex = e.Item.ItemInde x;
dgInner.DataSou rce = GetInnerGridDat a();
dgInner.DataBin d();
}

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 AutoGenerateCol umns="false"
BorderColor="#c ccccc"
BorderStyle="No ne"
BorderWidth="1"
CellPadding="3"
DataSource='<%# GetPrescription s(DataBinder.Ev al(Container.Da taItem,
"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_EditCom mand"
OnCancelCommand ="dgInner_Cance lCommand"
runat="server"
Width="80%">
<AlternatingIte mStyle Font-Size="XX-Small" Font-Names="Verdana"
ForeColor="Dark Blue" BackColor="Alic eBlue"></AlternatingItem Style>
<ItemStyle Font-Size="XX-Small" Font-Names="Verdana" Height="20px"
ForeColor="Dark Blue" BackColor="Whit e"></ItemStyle>
<Columns>
<asp:TemplateCo lumn HeaderText="Col umn 1">
<ItemTemplate >
<%# DataBinder.Eval (Container.Data Item, "c1") %>
</ItemTemplate>
</asp:TemplateCol umn>

<asp:TemplateCo lumn HeaderText="Com pleted">
<ItemTemplate >
<asp:CheckBox ID="chkLineComp leted" Enabled="False" Checked='<%#
DataBinder.Eval (Container.Data Item, "completed" ) %>' runat="server" />
</ItemTemplate>
<EditItemTempla te>
<asp:CheckBox ID="edit_chkLin eCompleted" Enabled="True" Checked='<%#
DataBinder.Eval (Container.Data Item, "completed" ) %>' Runat="server" />
</EditItemTemplat e>
</asp:TemplateCol umn>

<asp:TemplateCo lumn HeaderText="Act ion">
<itemtemplate >
<asp:imagebutto n runat="server" CommandName="Ed it"
ImageUrl="Image s/icon_edit.gif" ID="Imagebutton 1" AlternateText=" Edit"
Height="12" Width="12" />&nbsp;<br>
</itemtemplate>
<edititemtempla te>
<asp:imagebutto n runat="server" CommandName="Up date"
ImageUrl="Image s/icon_save.gif" ID="Imagebutton 2"
AlternateText=" Update" Height="12" Width="12" />&nbsp;&nbsp;
<asp:imagebutto n runat="server" CommandName="Ca ncel"
ImageUrl="Image s/icon_cancel.gif " ID="Imagebutton 3"
AlternateText=" Cancel" Height="12" Width="12" />&nbsp;<br>
</edititemtemplat e>
</asp:TemplateCol umn>
</Columns>
</asp:DataGrid>
Nov 18 '05 #1
0 1236

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

Similar topics

0
1218
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 after the first click, the even will fire correctly Has anyone had this problem before Thanks.........Bill
4
5970
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, they want the text value. Any advice, samples or places to read are appreciated. Thanks.
0
2259
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 firing for the child datagrid. I have set up a test page for myself to see if I can get this to work ..any help is appreciated! Thanks in advance (This is my complete page and code behind) <asp:DataGrid ID="_dgProj" AllowPaging=False
0
1052
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 call the LoadDataRow method to update the DataTable "in place". I've been using boundcolumns for the invisible fields, which worked fine, but now I've run into an issue with them. On the second of the 3 pages, the user can modify certain...
1
1688
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 if the record is part of an existing relationship, so the user can't update it. The "CareTypeID" field is the key and is invisible to the user. Here is the db table columns: CareTypeID
1
1375
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 Edit button, the datagrid disappears. Have I lost my datasource during postbacks or something? Here's my code: private void Page_Load(object sender, System.EventArgs e) { if(!Page.IsPostBack) {
1
1834
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 GridDataLangs(DataTable vDataTable){ DataGrid myGrid = new DataGrid(); myGrid.AutoGenerateColumns = false;
1
1239
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 is correct - that ViewState must be turned on. If this is true, does anyone know why it's true? Many TIA, -- Joe
1
2244
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 button click event fires, no problem. But the event for the EditCommand does not fire. Any Ideas? Any one else seen this? Here is some code: <cc2:ScriptManager ID="atlasScriptManager" runat="server"
0
8476
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8821
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8598
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7437
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5696
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4225
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4407
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2812
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2051
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.