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

Are there issues with using Datagrids in a Usercontrol?

I have a Datagrid that is in a user control on a webform I am creating and
when I click on the edit button of the datagrid nothing happens. I have to
click the button 2 times to get the event to fire. I put a
Response.Write("The edit button has been pressed"); inside the event to
test, and the event does fire but the edit boxes are not shown. When the
edit button is clicked the second time the edit boxes show, but the update
event also fires

I put similiar Response.write lines in the Cancel and Update events so I
know that the Update is being fired by the second press of the button. Even
the Cancel button takes 2 clicks to make it work.

Here is the code:
private void Fill_DataGrid()

{

//Assign the driver id to the select query

sqlSelectCommand1.Parameters["@DriverID"].Value = DriverNum;

//Fill the Dataset

sqlda.Fill(dsPrevEmp1);

//Bind the data from the dataset to the grid for display

dgPreviousEmployers.DataBind();

}

private void dgPreviousEmployers_EditCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)

{

dgPreviousEmployers.EditItemIndex = e.Item.ItemIndex;

RequiredFieldValidator1.Enabled = false;

Response.Write("Edit button has been pressed!");

}

private void dgPreviousEmployers_CancelCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)

{

dgPreviousEmployers.EditItemIndex = -1;

Response.Write("Cancel button has been clicked!");

}

private void dgPreviousEmployers_UpdateCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)

{

Response.Write("Update has been clicked!");

}
Nov 18 '05 #1
0 938

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

Similar topics

5
by: C. Alexander | last post by:
I'm trying to create a multi-user interactive whiteboard that has the ability to load a 'background' image to draw ontop of. The client/server needs to load a transparent layer for each user...
3
by: ProgramAnalyst | last post by:
Hi all, Is it possible to have a nested editable datagrid in an editable datagrid? So far I've created an editable datagrid that contains a usercontrol of an editable datagrid and the user...
4
by: Don | last post by:
Can please someone help before I go bald from pulling my hair out. I created a usercontrol that contains a combo box and an array list. Each item in the combobox has 1 additional parameter that...
11
by: Noozer | last post by:
Does anyone know if we will be able to put transparent backgrounds on UserControls in VB 2004?
1
by: Lee Trotter | last post by:
HI All, I have a webform application that has a page with 2 datagrids on it, above and below each other. The problem is that when the top grid ends up with with more rows then at design it, it...
0
by: mark | last post by:
I have a simple application where there are arrays (very large ones) displayed in datagrids. The datagrids are actually on a form 2 for which I create several instances. In working with the...
12
by: Joe | last post by:
Hello All: Do I have to use the LoadControl method of the Page to load a UserControl? I have a class which contains three methods (one public and two private). The class acts as a control...
7
by: crowl | last post by:
VS.2003, .NET Framework 1.1, C# My goal: Creating a dll (helper.dll) which contains some UserControls and some other helpful classes in order to use it in other projects. Symtoms: The...
3
by: Markus Kling | last post by:
Hi, I have a rich Forms UserControl which is embedded into a web page. Since installing .NET 2.0 on the clients, the control stopped loading completly. - I disabled security completly using...
0
by: Sugan | last post by:
Hi, I'm converting a VB 6.0 project to VB 2005. There are few issues, where i got stuck up. They are 1. 'Ambient' is not a member of 'System.Windows.Forms.UserControl' This is the code...
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
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
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
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
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,...

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.