473,473 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

datagrid not visible when databind() on editcommand

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)
{
PopulateForm();
}
}

private void PopulateForm()
{
dgReferences.DataSource = mySOP.Refs;//(mySOP.Refs is an arraylist)
dgReferences.DataKeyField = "RefID";
dgReferences.DataBind();
}

private void dgReferences_EditCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
dgReferences.EditItemIndex = e.Item.ItemIndex;
dgReferences.DataBind();
}
Nov 19 '05 #1
1 1365
It should be

private void dgReferences_EditCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
dgReferences.EditItemIndex = e.Item.ItemIndex;
PopulateForm();
}

HTH,

Elton Wang
el********@hotmail.com
-----Original Message-----
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 Iclick on the Edit button, the datagrid disappears. Have I lost my datasourceduring postbacks or something? Here's my code:

private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
PopulateForm();
}
}

private void PopulateForm()
{
dgReferences.DataSource = mySOP.Refs;//(mySOP.Refs is an arraylist) dgReferences.DataKeyField = "RefID";
dgReferences.DataBind();
}

private void dgReferences_EditCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArg s e)
{
dgReferences.EditItemIndex = e.Item.ItemIndex;
dgReferences.DataBind();
}
.

Nov 19 '05 #2

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

Similar topics

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,...
7
by: localhost | last post by:
A DataGrid with shows a label in one of the columns when in view mode. When in edit mode, I want to show a dropdown, and have the default selection set to what the textbox used to be. Right now...
1
by: Rick | last post by:
Hello all, I hope all is well with you. I am having a seriously difficult time with this problem. Allow me to set up the problem. I have a System.Web.UI.Page with the following controls...
4
by: tshad | last post by:
I am having trouble with links in my DataGrid. I have Links all over my page set to smaller and they are consistant all over the page in both Mozilla and IE, except for the DataGrid. Here is a...
3
by: Richard | last post by:
I've seen articles on GotDotNet and elsewhere on how to put a ddl in a datagrid, and have been able to implement this technique. For a new item, among the datagrid columns there is the one ddl for...
10
by: Terry Olsen | last post by:
I've got a datagrid set up to display data. I've also got an Edit,Update,Cancel column set up to allow editing of data. I've got a DropDownList (ID="ddl3")in the EditItemTemplate for a certain...
5
by: tshad | last post by:
Is there a way to carry data that I have already read from the datagrid from page to page? I am looking at my Datagrid that I page through and when the user says get the next page, I have to go...
0
by: arlie_maija | last post by:
Hey - I'm writing a control that contains a DataGrid, and I'm unable to get the update event to fire. When I click the update link, the edit event fires. heres the details... my control...
2
by: slinky | last post by:
I had a successfully deployed datagrid reading an XML file and showing the data: Private Function MakeDataView() as DataView Dim myDataSet As New DataSet()...
0
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,...
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...
1
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
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 ...

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.