|
Darn Cotts posted:Oh please someone help me before I go completely insane!
|
![]() |
|
![]()
|
# ? Jun 10, 2024 14:54 |
|
What Safrax said. Only other note is that you should always wrap the action code in a if (IsValid) statement to back up client-side validation.
|
![]() |
|
Ah ha, cheers guys ![]()
|
![]() |
|
Does anyone know how to generate custom labels for data bound ASP.NET FormView controls?code:
|
![]() |
|
Celebrity Toaster posted:I'm trying to set the text of a listview sub item, but it doesn't appear to be playing ball bump! I'm back at work after a week off and still can't fix this drat problem. The subitem.text property is getting set fine, i have attached an event to the mousedown of the list view that will pop up a message box containing the current text of the clicked subitem. Clicking a subItem displays the desired text in the message box, but not in the listview. Any ideas? This is driving me insane ![]()
|
![]() |
|
Celebrity Toaster posted:bump! I'm back at work after a week off and still can't fix this drat problem. The subitem.text property is getting set fine, i have attached an event to the mousedown of the list view that will pop up a message box containing the current text of the clicked subitem. Clicking a subItem displays the desired text in the message box, but not in the listview. Any ideas? This is driving me insane Stupid questions: 1. How many columns do you have? 2. Can you write a piece of code, triggered on a button that does code:
3. Is there any other code that could potentially be changing the data in the listview? Have you tried a new project, just a listview and a button? 4. The listview is in Details mode, right? 5. This code isn't in some larger Try/Catch block, and you are just missing an exception being thrown is it? 6. j does start at 0, right? 7. Is column 1 visible? You don't have a phantom column or something? binary_hero fucked around with this message at 17:42 on Mar 12, 2007 |
![]() |
|
Have you tried using RedrawItems(0,j,false) instead of Invalidate and Redraw?
|
![]() |
|
SpaceWokker posted:Does anyone know how to generate custom labels for data bound ASP.NET FormView controls? Don't quote me on this, but I suspect if one set the meta data correctly in Sql Server (or the correct attributes in your Object Data Source) then the *view controls would pick it up.
|
![]() |
|
I'm trying to run unit tests through TestDriven.Net, but I'm getting a really weird error back from TestDriven:code:
code:
|
![]() |
|
I'm writing a custom control that's derived from TextBox, and I want to select all the text in it when the control gains focus. I thought this would be pretty simple to do; just override OnGotFocus and add SelectAll(); to it. This works when using tab to focus on it, but when using the mouse, it does nothing. Any ideas?
|
![]() |
|
Inquisitus posted:I'm writing a custom control that's derived from TextBox, and I want to select all the text in it when the control gains focus. I thought this would be pretty simple to do; just override OnGotFocus and add SelectAll(); to it. This works when using tab to focus on it, but when using the mouse, it does nothing.
|
![]() |
|
Thank you, good sir ![]()
|
![]() |
|
I have a general "moving from WinForms to WebForms" question. I use business objects extensively in my c# apps, and was hoping to reuse as much of those objects as possible in ASP. I'm wondering, what's the smoothest way to reuse my BO's? Write a wrapper for each one, with an interface supported by ObjectDataSource? Or is there a shortcut? For a bit of background, all of my custom collections inherit from BindingSource, and likewise all my individual "entities" inherit from a common source. The problem is that they all generated by a Factory, including the collections. How do you handle this?
|
![]() |
|
First, you don't have to use object data source to do stuff using ASP.NET. Old fashioned databinding works just fine with the new controls and really can be your only viable option depending on how your objects behave. If you really must use object data source, then you will probably want to extend the object data source to embrace your framework by overriding the appropriate events.
|
![]() |
|
Darn Cotts posted:Oh please someone help me before I go completely insane! Not sure what these other guys used, but when learning ASP.Net I found the Wrox Professional ASP.Net 2.0 book to be very solid. You should give it a look.
|
![]() |
|
sorry wrong place to ask my qestion
Angry Midget fucked around with this message at 09:29 on Mar 20, 2007 |
![]() |
|
Qaz Kwaz posted:Not sure what these other guys used, but when learning ASP.Net I found the Wrox Professional ASP.Net 2.0 book to be very solid. You should give it a look. That book was very helpful to me when I had to learn ASP .NET. It's not perfect, but it's pretty drat good. As far as data binding goes, as someone said above, in almost every case, I've gotten by with just assigning a collection of my business objects to the datasource property of the databound control.
|
![]() |
|
^^^See, I am not alone. I forgot to mention that, under the hood, this is pretty much what ObjectDataSource is doing. It just exists to make you write less UI code if you are willing to water things down to it's level.
|
![]() |
|
I am having a problem formatting a datagrid programatically. I have created a Pocket PC application using the .NET compact framework. I have a web service that calls a stored procedure in an Oracle database and returns a dataset. I have been able to populate my datagrid with the two columns from the data set. However I want to be able to adjust the width of the columns in the datagrid, and change the column headers. The columns in the dataset are LOT_NUMBER, and SPECS Here is my code: HeatNumber = tbHeatNum.Text; Service FindSlabs = new Service(); DataSet Slabs = new DataSet(); //Fills the dataset from a web service calling a stored proc. Slabs = FindSlabs.GetHeatSlabs(HeatNumber); //dgSlabs is the name of my datagrid dgSlabs.DataSource = Slabs.Tables[0]; DataGridTableStyle ts = new DataGridTableStyle(); ts.MappingName = "dgSlabs"; // Slab Id column DataGridColumnStyle SlabNum = new DataGridTextBoxColumn(); SlabNum.MappingName = "LOT_NUMBER"; SlabNum.HeaderText = "Slab"; SlabNum.Width = 200; ts.GridColumnStyles.Add(SlabNum); DataGridColumnStyle specs = new DataGridTextBoxColumn(); specs.MappingName = "SPECS"; specs.HeaderText = "Size"; specs.Width = this.Width - SlabNum.Width - 37; ts.GridColumnStyles.Add(specs); dgSlabs.TableStyles.Add(ts); I am not sure what to enter for the MappingName of the DataGridTableStyle. I'm a .Net noob, so any advice would be greatly appreciated.
|
![]() |
|
Back again for my weekly DataGridView problem that nobody will reply to. ![]() I have a DataSet containing some data and a BindingSource object that is bound to a particular table in the DataSet. Then I have two DataGridViews on different tab pages that should both display the data from the DataSet, via the BindingSource. I set the DataSource and DataMember properties of the BindingSource to correspond to the table in the DataSet, and I set the DataSource property of both the DataGridViews to be the BindingSource. Then, at some later point in time, the DataSet is populated with data by another thread and when that's complete I call Refresh on all the DataGridViews. The problem I'm having is that only the first grid that was bound is updating to show the rows that get added. I've tried checking the number of rows in the BindingSource just before the second grid refreshes, and it's correct, but the rows just aren't appearing there. Any ideas? edit: Solved! Needed to call ResetBindings on the BindingSource. Darn Cotts fucked around with this message at 16:48 on Mar 20, 2007 |
![]() |
|
binary_hero posted:Stupid questions: I managed to "fix" the problem, by setting the first column's text equal to itself again whenever I adjusted a different cells value. This was the only way I could seem to trigger the control to update. I'm still perplexed as to why it happened in the first place.
|
![]() |
|
Does anyone know a good way to map a network share through .NET, other than launching net use in a new process?
|
![]() |
|
My friend/coworker was telling me about a plugin for Visual Studio that tells me what code has been covered by NUnit and somehow highlights code that hasn't. But, he is out sick today, and I don't know the name of it. Does anyone know what he might be talking about?
|
![]() |
|
Ethangar posted:My friend/coworker was telling me about a plugin for Visual Studio that tells me what code has been covered by NUnit and somehow highlights code that hasn't. But, he is out sick today, and I don't know the name of it. Does anyone know what he might be talking about? "How to: Obtain Code Coverage Information" http://msdn2.microsoft.com/en-us/library/ms182496(VS.80).aspx In the end it generates a .cov file. You open this file in VS and it colours your source code red or green or whatever. (PS. I've never used it myself! a colleague demonstrated bits of it to me yesterday.)
|
![]() |
|
I think he is actually looking for NCover, which is pretty drat sweet.
|
![]() |
|
How can you detect if a control has finished being loaded? There is an event that occurs both when the control is initially loaded, as well as when the user interacts with the control, and I only want to respond to the event on user interaction. There doesn't seem to be a bool that indicates this, and google isn't being very helpful.
|
![]() |
|
Belgarath posted:How can you detect if a control has finished being loaded? There is an event that occurs both when the control is initially loaded, as well as when the user interacts with the control, and I only want to respond to the event on user interaction. I don't understand what you're asking here. What event are you talking about? There are a lot of events that occur when the user interacts with the control...MouseDown/Up, MouseEnter/Exit, Got/LostFocus, In/Validate, KeyUp/Down to name a few. What are you trying to accomplish?
|
![]() |
|
Daddy Fantastic posted:Does anyone know a good way to map a network share through .NET, other than launching net use in a new process? Here you go code:
|
![]() |
|
csammis posted:I don't understand what you're asking here. What event are you talking about? There are a lot of events that occur when the user interacts with the control...MouseDown/Up, MouseEnter/Exit, Got/LostFocus, In/Validate, KeyUp/Down to name a few. What are you trying to accomplish? Ok, I guess I wasn't very specific, I apologise. Here goes: I'm coding in c#, and I'm using a DataGridView, and I'm interested in the RowEnter event. MSDN says that "This event occurs when the DataGridView is initially loaded, as well as when the user selects a row other than the current row." I only want to respond to the event when the user selects a row other than the current row, not when the control is initially loaded.
|
![]() |
|
Goonamatic posted:Here you go
|
![]() |
|
Belgarath posted:Ok, I guess I wasn't very specific, I apologise. Here goes: I don't use that control very much, so there probably is a better way to do this, but.... You could have a member variable int that is the numer of rows and decrement it in the rowEnter event. When it reaches zero, you know that it's done loading. Alternately I don't know if the RowLeave event gets called on load, but if it doesn't, you can use a bool member variable that you set to true on RowLeave. A row would have to be left before another can be entered.
|
![]() |
|
Ok this is really blowing my mind. VB.NET.code:
I run the program, click the first button. I get nothing as expected. Click the second button, and a msgbox with "1" comes up (so 1 row affected). I click it again, and again, 1 row affected. I click the first button and I get two consecutive msgboxes, both with "hi there". Great! I go look at the access mdb file...no rows have been added. I close the program, run it again, click the first button. Nothing. The inserts make it into the database, I can select them out, but it's like they're not REALLY there. Or something. I'm really confused.
|
![]() |
|
Ok after more than an hour, I finally got it. VS dumps all your resources to a ./bin/Debug subdirectory, INCLUDING THE LOCAL DATABASE you may be operating on. That's why there was always a fresh copy of the db when I started the program. Unbelievable.
|
![]() |
|
poopiehead: I'd not thought of trying that, I've been looking for a neat '.net way' to do it. Thanks.epswing posted:Ok after more than an hour, I finally got it. VS dumps all your resources to a ./bin/Debug subdirectory, INCLUDING THE LOCAL DATABASE you may be operating on. That's why there was always a fresh copy of the db when I started the program. In the solution explorer, if you right click the local database you are working with (I assume an Access db), and click 'Properties', you can get VS to stop copying it every time, there are 3 options: Do not copy, Copy always and Copy if newer. This is true for any file e.g. pictures, sound files etc (I believe).
|
![]() |
|
Ethangar posted:My friend/coworker was telling me about a plugin for Visual Studio that tells me what code has been covered by NUnit and somehow highlights code that hasn't. But, he is out sick today, and I don't know the name of it. Does anyone know what he might be talking about? Sounds like http://www.testdriven.net/
|
![]() |
|
Munkeymon posted:Sounds like http://www.testdriven.net/ Yeah, I already had that to run NUnit from Visual Studio. I totally missed the coverage part of it.
|
![]() |
|
I have an ASP.NET application that runs off of an Access database (I know, I know, but I can't change it now). I'm looking for an Access db/table editor in ASP.NET. The feature I really need is a way to create new tables via GUI and it needs to be able to allow me to set the "Allow Zero Length" parameter (or at least default to "Yes"). Anyone know where I can find one?
|
![]() |
|
I built a Windows service for a customer. The service is taking 99% CPU on the machine they have it installed on, however, I didn't write any busy waiting, nor any for loops that could degenerate into an infinite loop. Most of the time, the service should just be listening to a socket waiting for network input, so it should hardly be using any CPU at all. I thought that maybe somewhere in one of the Framework methods it's doing some busy waiting, but how would I go about confirming that?
|
![]() |
|
Hey! posted:how would I go about confirming that? When I want to know what the framework is doing, I use the reflector. It's not really an optimal solution for the problem, but has solved several mysteries for me.
|
![]() |
|
![]()
|
# ? Jun 10, 2024 14:54 |
|
Hey! posted:I built a Windows service for a customer. The service is taking 99% CPU on the machine they have it installed on, however, I didn't write any busy waiting, nor any for loops that could degenerate into an infinite loop. Most of the time, the service should just be listening to a socket waiting for network input, so it should hardly be using any CPU at all. I thought that maybe somewhere in one of the Framework methods it's doing some busy waiting, but how would I go about confirming that? Get some trace utilities, such as JetBrains DotTrace. It will tell you where things are hanging.
|
![]() |