473,774 Members | 2,232 Online
Bytes | Software Development & Data Engineering Community
+ 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(objec t sender, System.EventArg s e)
{
if(!Page.IsPost Back)
{
PopulateForm();
}
}

private void PopulateForm()
{
dgReferences.Da taSource = mySOP.Refs;//(mySOP.Refs is an arraylist)
dgReferences.Da taKeyField = "RefID";
dgReferences.Da taBind();
}

private void dgReferences_Ed itCommand(objec t source,
System.Web.UI.W ebControls.Data GridCommandEven tArgs e)
{
dgReferences.Ed itItemIndex = e.Item.ItemInde x;
dgReferences.Da taBind();
}
Nov 19 '05 #1
1 1380
It should be

private void dgReferences_Ed itCommand(objec t source,
System.Web.UI.W ebControls.Data GridCommandEven tArgs e)
{
dgReferences.Ed itItemIndex = e.Item.ItemInde x;
PopulateForm();
}

HTH,

Elton Wang
el********@hotm ail.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(objec t sender, System.EventArg s e)
{
if(!Page.IsPos tBack)
{
PopulateForm();
}
}

private void PopulateForm()
{
dgReferences.Da taSource = mySOP.Refs;//(mySOP.Refs is an arraylist) dgReferences.Da taKeyField = "RefID";
dgReferences.Da taBind();
}

private void dgReferences_Ed itCommand(objec t source,
System.Web.UI. WebControls.Dat aGridCommandEve ntArgs e)
{
dgReferences.Ed itItemIndex = e.Item.ItemInde x;
dgReferences.Da taBind();
}
.

Nov 19 '05 #2

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

Similar topics

4
5980
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.
7
4222
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 the first item in the dropdown is always displayed. Template Code: <asp:TemplateColumn HeaderText="DropDown"> <ItemTemplate> <asp:Label runat="server" Text='<%# DataBinder.Eval
1
4340
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 (watch the layout, some have child controls):
4
3496
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 snippet from my .css file: *************************** body { margin:0; padding:0;
3
1818
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 the user to choose an account description, and when the user saves, then the value is saved and displayed in a bound column in the datagrid. So far so good. The problem is when the user edits the line. The ddl is refreshed with all of the...
10
1909
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 column that I need to populate while in Edit Mode. Two questions: Is there a way to directly use another DropDownList as a DataSource? If so how? I'm using the following code to try to populate the DropDownList, but
5
2793
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 to the database to get the next page. Is there a way to use the dataset to allow us to read back and forth in it instead of going back to the database to get it? Thanks,
0
1535
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 overrides CreateChildControls and dynamically creates the DataGrid, creates an EditCommandColumn which it adds to the
2
1324
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() myDataSet.ReadXml(Server.MapPath("TimberSales.xml")) Dim view As DataView = New DataView(myDataSet.Tables(0)) view.AllowDelete = False view.AllowEdit = True view.AllowNew = False
0
9621
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
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10267
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10106
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
10046
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
9915
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8939
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
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4014
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

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.