The problem stems from button1 having it's DialogResult property set. When button1 click event is fired, it executes button1_Click, displays the are you sure dialog and regardless of the result of the are you sure dialog will close the window form because it has a DialogResult set. I was wondering if I could cancel this close window event depending on the result of the are you sure dialog. I can simply not set the DialogResult property of button1, and set the DialogResult in the button1_Click event depending on the result of the are you sure dialog. Regards.
Dominic Farr
Posts
-
cancel event -
cancel eventI have a windows form with a button that I have set the DialogResult property. The button also has a click event. When the click event fires, my event methods displays an MessageBox with Yes or No buttons. (an 'are you sure' type message) If the user clicks the No button I want to cancel closing of the window form event. How I can I achieve this. Thanks
-
Permission IssuesI have an MS Access database as part of my asp.net project. When I install my application int IIS the database is include, but I have grant the ASPNET user access to the directory and database.mdb file before my web application can query my database. Why do I have to grant access manually, I don't have to grant access to any other file. Is there a way I can automatically grant access during installation.
-
Debug WebSetup ProjectI have a WebSetup for my C# web project. I also have a class that extends System.Configuration.Install.Installer, a custom application that is called when I install my web project. Is there anyway I can use the debugger on my custom action class? I'd like to step through my code while installing.
-
Repeater DateItemI have a Repeater with many rows. However, when I foreach through the items the DataItem is null. Why can I not get the DataItem from my Repeater? Or maybe a better question would be, how do I get the DataItems from my repeater? thank you -- modified at 13:11 Thursday 12th January, 2006
-
Currency Symbolthank you
-
Currency SymbolHow can I get the currency symbol from just the ISO 4217 standard 3-letter code.
CAD = $ USD = $ GBP = £ YEN = ¥
I tried creating a RegionInfo by stripping out the first two characters of the 3-letter code but is doesn't work for all cases. Any ideas? -
Currency SymbolHow can I get the currency symbol from just the ISO 4217 standard 3-letter code. CAD = $ USD = $ GBP = £ YEN = ¥ I tried creating a RegionInfo by stripping out the first two characters of the 3-letter code but is doesn't work for all cases. Any ideas?
-
Web Setup ProjectI've created a simple web setup project in VS 2003. When I install my web project is puts all the aspx pages in the wwwroot area and creates a bin directory with the dll. However, when I uninstall my web project it does not remove the any of the files. Why not? Surely if I uninstall if should remove all trace!
-
Access Databases in ASP.NetI'm using an access database in my web project. I have two questions that I'm unsure about. After installing my web project on the host machine.....
It seems that I have to add read/write security permissions for the folder and
access mdb file for the ASPNET user. Is that the correct thing to do, or is
there another way around it. Without it I cannot update tables via my web project.Can the access database handle concurrent users/browsers reading and writing or
do I need to serialize the connections?-- modified at 16:15 Thursday 15th September, 2005
-
ListView GridLines Don't line upWhen you set GridLines = true in the ViewList the grid lines don't match up with the column. How do I fix this? Thank you
-
Keeping selected row after sortI've learnt some great things here, thanks. I'm interested in why the DataView.Enumerator returns the results in the correct sorted order where as the DataView.Table.Rows list is always in the unsorted order. Best regards
-
Question concerning Sorting DataGridsTwo part to this. Part1 (Save Row ID) Each time a user selects a row in your DataGrid you need to save the row's unique idenifier. Part2 (Re select Row based on ID) After sorting, locate the new location of your selected row using the saved unique row identifier. Example Part 1
// set selected row's id in view state
IEnumerator enu = ((DataView)DataGrid1.DataSource).GetEnumerator();
int index = 0;
while( index <= DataGrid1.SelectedIndex )
{
enu.MoveNext();
index++;
}DataRowView rowView = enu.Current as DataRowView;
DataRow row = rowView.Row;
ViewState["item"] = (int)row["ID"];Example Part 2
DataView sortView = dataSet1.MyTable.DefaultView;
// numberDiv is a static int
if( ( numberDiv % 2 ) == 0 )
{
sortView.Sort = e.SortExpression + " ASC";
}
else
{
sortView.Sort = e.SortExpression + " DESC";
}
numberDiv++;// set new sort into ViewState
ViewState["sort"] = sortView.Sort;// set sorted dataview
DataGrid1.DataSource = sortView;// bind data
DataGrid1.DataBind();// here reselected your row
// check that you have an item selected
if( ViewState["item"] != null )
{
int id = (int)ViewState["item"];
int index = -1;
IEnumerator enu = sortView.GetEnumerator();
while(enu.MoveNext())
{
index++;
DataRowView rowView = enu.Current as DataRowView;
DataRow row = rowView.Row;
int rowID = (int)row["ID"];
if(rowID == id)
{
break;
}
}
DataGrid1.SelectedIndex = index;
}Hope this helps. My thanks to minhpc_bk
-
Keeping selected row after sort..thank you for your thoughts. I can't use
DataView.Find
as the sort key doesn't return a unique values. The table has a unique identifier. ID. This ID is a column in theDataGrid
at present but won't be in the finished version. I'm use showing it to help debug. The user selects a row, triggers an event, I saved the ID of the selected row and highlight it in theDataGrid
Then the user clicks a column to sort theDataGrid
and the follow code is performed.DataView dv = dataSet.MyTable.DefaultView; dv.Sort = "column"; DataGrid1.DataSource = dv; DataGrid1.Bind();
How can I then loop through and find (using the ID) which row in the DataGrid or DataView contains the row of the selected item. Which I will use to setDataGrid1.SelectedIndex
. It isn't clear to me that this is possible. -
Question concerning Sorting DataGridsI'm trying to do the same thing. If you find out a way do it let me know, Thank you
-
Keeping selected row after sortDataGrid, DataView, Sort - All great things. What I'm having trouble doing is keep my selected row selected after I column sort. The selectedIndex is no longer valid because of the sort. So how do I find the current row index of the previously selected item. ?
-
ASP .Net - C# - Datagrid : selecting a row by clicking it (no button)Excellent. Thanks
-
ASP .Net - C# - Datagrid : selecting a row by clicking it (no button)Could you shed some light on the __doPostBack paramter "DataGrid1$_ctl2$_ctl0" DataGrid1 (the control) _ctl2 (? the row of the table) Why do you take the index and + 2 _ctl0 (? got me) Thank you
-
Like foreach but from end to begining ?char[] chars = "this is a very long string, not!".ToCharArray(); Array.Reverse(chars); foreach(char c in chars) { // do what you want }
-
Label Click Event LocationHello all. Take a Label with Image or ImageList and add Click Event. Then.... ...Determine if click event occurred within the bounds of the image or within the bounds of the label text. Any Ideas? (I know I could just make two controls, an image and a label and put them next to each other....but humour me a little please:))