473,385 Members | 2,210 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,385 software developers and data experts.

Button outside datagrid

Hello group,
I have a datagrid(dg) and a couple of buttons outside the
dg( 'New'& 'Done'). Have a 'save' button inside the dg that responds
to itemcommand event. On a 'New' button click, the footer(textbox) is
displayed in the dg which acts like a new row addition. the 'save'
button corresponds to the footer textbox and hence triggers the
itemcommand event on a save and the logic to add it as a row to the dg
goes in there.
Now, I need to trigger the same event when one clicks the
'Done' button which is outside the datagrid. Can I get a handle of the
footer(textbox) in the 'Done' event click.
Any help would be appreciated!!

Thanks,
Sam.

Nov 19 '05 #1
2 1432
<sr*****@mailcity.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hello group,
I have a datagrid(dg) and a couple of buttons outside the
dg( 'New'& 'Done'). Have a 'save' button inside the dg that responds
to itemcommand event. On a 'New' button click, the footer(textbox) is
displayed in the dg which acts like a new row addition. the 'save'
button corresponds to the footer textbox and hence triggers the
itemcommand event on a save and the logic to add it as a row to the dg
goes in there.
Now, I need to trigger the same event when one clicks the
'Done' button which is outside the datagrid. Can I get a handle of the
footer(textbox) in the 'Done' event click.


You don't need to trigger the same event in order to get the same code
executed. Have the save event execute a subroutine and have the same
subroutine executed by the Done button click event:

private void dg_ItemCommand(object sender, DataGridItemEventArgs e)
{
if (e.CommandName == "Save")
{
SaveData();
}
}

private void Done_Click(object sender, EventArgs e)
{
SaveData();
}

private void SaveData()
{
// Save the data from the footer controls
}

John Saunders
Nov 19 '05 #2
Since, its a footer item I am trying to access. The code below seems
to work great!

DataGridItem
dgi=this.DataGrid1.Controls[0].Controls[this.DataGrid1.Controls[0].Controls.
Count-1] as DataGridItem;

Nov 19 '05 #3

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

Similar topics

0
by: Eugene | last post by:
Hello all, I've been trying to figure this out for a few days now, and still have no clue what's going on... I have a few related tables in MS Access (Clients, Cars, Sales), and a datagrid,...
3
by: Zürcher See | last post by:
Someone has implemented a Datagrid Button for the Windows.Form?
0
by: JoRo | last post by:
I am working on a project where I want a very user-friendly interface. I have a datagrid of categories that uses the EditCommandColumn to do in-line editing of the category name. On the page is...
1
by: headbig003 | last post by:
Hello I am using dataset to populate datagrid. I use button outside of datagrid to insert new row and update datagrid. After updated or inserted new information to datagrid, user has to...
0
by: geek | last post by:
Hi, I have to bind a submit button that links to the datagrid checkboxes. I am not sure how can I link the checkboxes to the submit button because the submit button is outside the datagrid. ...
5
by: Samy | last post by:
Hi There, I have a label in a datagrid which I make it a input type = radio in ItemDataBound so that radio buttons are shown in the datagrid. This is how I have it... ASPX... <asp:Label...
5
by: Tina | last post by:
the Edit, Update, Cancel, and Delete buttons in my datagrid are causing validation elsewhere on the page. I want to specify that these buttons should not cause validation but they have no design...
5
by: Jeff User | last post by:
Hello ..NET 1.1, VS 2003, C# & asp.net I have tried to follow msdn instructions and samples but I can not get an event to fire for this button on the datagrid. There has to be something obvious...
1
by: geeteshss | last post by:
Dear all, actually i spent a whole month on the R&D of datagrid edit ,update,cancel events but recently my guide told me to make it user friendly because no user would like to go on searching rows...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.