Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Hey!
Feb 27, 2001

MORE MONEY = BETTER THAN
Is anyone using the ASP.NET AJAX Control Toolkit? I don't get how I'm supposed to actually use these controls in my projects. It ships as a solution with a sample web project with a ton of folders... uh, thanks? I'm wondering how I can use these controls the same way I use asp:TextBox and so forth.

Adbot
ADBOT LOVES YOU

wwb
Aug 17, 2004

Add the DLL to your project as appropriate, then declare the proper control reference:

code:
<pages>
        <controls>
          <add namespace="AtlasControlToolkit" assembly="AtlasControlToolkit" tagPrefix="atlasTk" />
        </controls>
</pages>
Note that the dll reference is probably not correct as this is copied from a pre MSAJAX site.

Darn Cotts
Mar 12, 2004

\Job"ber*nowl`\, n. [OE. jobbernoule, fr. jobarde a stupid fellow; cf. E. noll.] A blockhead. [Colloq. & Obs.]
Hi,
I have an unbound DataGridView that I populate programatically. One of the columns is a Time column, and whenever the user modifies the value of a cell in that column I call the Sort method to re-sort the rows. My problem is that if, say, you enter a new time and hit tab to move to the next column, the columns are re-sorted but the current row index stays the same, so the currently edited cell becomes the next column across on the new row with the row index. Instead of this, I need it to move to the next column but on the row that was originally selected, wherever it may have moved to in the table.

I'm keeping track of which row should be selected in a way that is invariant of the actual ordering of the rows elsewhere using the SelectionChanged event. Just before I call Sort I set an internal flag so that SelectionChanged events are ignored during the sort, and then in response to the Sorted event I reset this flag. In the Sorted event handler I am selecting the row that should be selected, but something is causing this to be undone and changing the selection after the Select event has been and gone.

Any ideas? I realise I've explained all that pretty badly, feel free to ask questions.

Yaksha
Jun 28, 2005

Demilich
Has anyone ever developed an ASP.NET application on GoDaddy? I'm having problems.

I'm using Visual Web Developer Express Edition. I would like to design and test the application on my PC and then publish it to GoDaddy but I am having issues with SQL.

With GoDaddy and SQL Server, you have to create the database in their control panel (and it resides on another server). They give you the address and everything for it, but GoDaddy doesn't allow remote linking for their databases. So how do I test my system remotely?

I tried putting in the connection string provided by GoDaddy, but it keeps spitting back an error (in VWD) about how remote linking isn't allowed.

mr brown
Feb 26, 2003
Mr. Brown? That sounds too much like Mr. Shit.

Yaksha posted:

With GoDaddy and SQL Server, you have to create the database in their control panel (and it resides on another server). They give you the address and everything for it, but GoDaddy doesn't allow remote linking for their databases. So how do I test my system remotely?

I tried putting in the connection string provided by GoDaddy, but it keeps spitting back an error (in VWD) about how remote linking isn't allowed.

Can you use a local database?

Yaksha
Jun 28, 2005

Demilich

mr brown posted:

Can you use a local database?

I'm trying to figure out how, with limited success.

VWD installed SQL 2005 Express Edition on my computer. GoDaddy uses SQL 2000.

This is what my connection string looks like:

quote:

<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\NewTest.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />

This works fine on my local machine.

When I try and use this connection string on GoDaddy I get the following:

quote:

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

I'm not really sure why I get a "does not allow remote connections" error when the database is local.

I've tried changing a few things, but every time I do it errors out both my local machine and the GoDaddy page.

First I tried to change "|DataDirectory|\NewTest.mdf" to "App_Data\NewTest.mdf" - I got the following error on my local machine:

quote:

An attempt to attach an auto-named database for file App_Data\NewTest.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

And GoDaddy spits out the same "does not allow remote connections" error.

Yaksha fucked around with this message at 18:39 on Mar 6, 2007

wwb
Aug 17, 2004

What connection string does godaddy tell you to use?

Yaksha
Jun 28, 2005

Demilich
I created a database on GoDaddy, however, it's empty. The connection string is:

Data Source=whsql-v16.prod.mesa1.secureserver.net;Initial Catalog=DB_137;User ID=USERNAME;Password=PASSWORD;

I cannot, however, connect to this database from my local machine. It's also empty.

I guess I need a way to populate this database. I can't seem to find a way in VWD to export the data from my SQL database to a CSV file. Anyone know how to do this?

poopiehead
Oct 6, 2004

I don't use Express, but it might have this functionality. In SQL Server Management Sudio, I right click on a database, then choose tasks, then generate scripts and you can script at least the tables and procedures. I don't think you can get data that way though. There is an export data wizard that can make a flat file, that you could then probably import to GoDaddy

Yaksha
Jun 28, 2005

Demilich

poopiehead posted:

I don't use Express, but it might have this functionality. In SQL Server Management Sudio, I right click on a database, then choose tasks, then generate scripts and you can script at least the tables and procedures. I don't think you can get data that way though. There is an export data wizard that can make a flat file, that you could then probably import to GoDaddy

I get lots of errors when I open SQL Server Management Studio, I'm assuming that's because of the version of SQL Server that comes with VWD is dumbed down? Or it doesn't actually install SQL on my computer like it should? I'm not really sure.

MrBishop
Sep 30, 2006

I see what you did there...

Soiled Meat
Can someone recommend me a good tutorial, guide, or advice for managing events in an MDI environment? I'm looking for a little help with this situation:

I have 4 or 5 families of classes in my program, which are used in an MDI program. Now, I have no problem tying events in a child form back to the parent that created it. However, I now have forms coming and going and I need to have certain forms catch events from others, even if the one didn't launch the other. For example, it's possible to open and close a product list form at any time, but if an "Edit product" form is already open, the list form needs to be able to hook into that so that the list can update when the edit completes.

One solution that comes to mind is to get the list of all child windows from the MDI parent, and loop through those looking for a particular type, then hook into that type if it matches a type I can handle. Other ideas?

Orzo
Sep 3, 2004

IT! IT is confusing! Say your goddamn pronouns!

MrBishop posted:

Other ideas?
Why not just instantiate each of these controls with some sort of a 'controller' object, which manages exactly the kind of events you're concerned with? Make the controller hold a list of items with an interface, say, IControllable, and make each of your sub-forms implement IControllable. An example method on IControllable would be 'UpdateAfterEditComplete()'.

The documents can call methods on the controller, which propogates down to the other documents.

wwb
Aug 17, 2004

poopiehead posted:

I don't use Express, but it might have this functionality. In SQL Server Management Sudio, I right click on a database, then choose tasks, then generate scripts and you can script at least the tables and procedures. I don't think you can get data that way though. There is an export data wizard that can make a flat file, that you could then probably import to GoDaddy

gently caress a flat file; you need the sql server hosting toolkit.

Verve
Nov 19, 2005
I'm having a problem with the included Crystal Report control in Visual Studio 2005.

What I'm trying to do is to change the database location used by the report at run time.

code:

CyrstalReport1 rpt = new CrystalReport1();

rpt.DataSourceConnections[0].SetConnection("","D:\temp\data.mdb",false);
crystalReportViewer1.ReportSource = rpt;

For some reason, the report still try to load the previous database and always prompt me to input login and password (I didn't set any password on both databases). Any help will be appreciated.

Yaksha
Jun 28, 2005

Demilich

poopiehead posted:

I don't use Express, but it might have this functionality. In SQL Server Management Sudio, I right click on a database, then choose tasks, then generate scripts and you can script at least the tables and procedures. I don't think you can get data that way though. There is an export data wizard that can make a flat file, that you could then probably import to GoDaddy

Where is the export wizard?

I was finally able to get Microsoft SQL Server Management Studio Express to open (had to uninstall everything, including the 2.0 framework, then reinstall) and while I can export my table structures, I can't get any of the data to go with it.

To restate my problem:

Visual Web Developer Express Edition creates a database file, called ASPNETDB.MDF. I can't simply upload this to GoDaddy and have everything work.

I need to be able to export all table structures (and probably all the stored procedures and such) as well as all the data to a .sql file so I can use the Query Analyzer to get all the DB data to GoDaddy.

Does anyone know I can export all of my .mdf information into a .sql file?

poopiehead
Oct 6, 2004

Yaksha posted:

Where is the export wizard?

I was finally able to get Microsoft SQL Server Management Studio Express to open (had to uninstall everything, including the 2.0 framework, then reinstall) and while I can export my table structures, I can't get any of the data to go with it.

To restate my problem:

Visual Web Developer Express Edition creates a database file, called ASPNETDB.MDF. I can't simply upload this to GoDaddy and have everything work.

I need to be able to export all table structures (and probably all the stored procedures and such) as well as all the data to a .sql file so I can use the Query Analyzer to get all the DB data to GoDaddy.

Does anyone know I can export all of my .mdf information into a .sql file?

This might not be included on the express version.

Yaksha
Jun 28, 2005

Demilich

poopiehead posted:

This might not be included on the express version.



I do have a "Generate Scripts" option, however, this is what I did earlier and it only seemed to export the table structure, not the data. (I don't have import/export).

Perhaps there was an option I forgot to set to true? Append to file? Script Full Text Indexes?

poopiehead
Oct 6, 2004

Yaksha posted:

I do have a "Generate Scripts" option, however, this is what I did earlier and it only seemed to export the table structure, not the data. (I don't have import/export).

Perhaps there was an option I forgot to set to true? Append to file? Script Full Text Indexes?

That sounds about right. Generate Scripts can do stored procedures and tables, etc, but not the data in the tables. If you don't have an export option in that menu, you may be screwed(at least using this application)

ora_ocp
Feb 9, 2007
DBA'in ain't easy
I have a question for the local .Net Pros:

I created a web service, and added a few small methods.

I then created a new smart device project and I want to reference the web service. I clicked on add a web reference,and choose my service from the list on my local host.

However I get the following error:

A name was started with an invalid character. Error processing resource 'http://localhost/TestService/TestServic...

<%@ WebService Language="C#" CodeBehind="TestService.asmx.cs" Class="TestService.Service1" %>
-^

It appears the % sign is a problem for some reason, here is a more detailed error explanation.


The document at the url http://localhost/TestService/TestService/TestService.asmx was not recognized as a known document type.
The error message from each known type may help you fix the problem:
- Report from 'DISCO Document' is 'Name cannot begin with the '%' character, hexadecimal value 0x25. Line 1, position 2.'.
- Report from 'WSDL Document' is 'There is an error in XML document (1, 2).'.
- Name cannot begin with the '%' character, hexadecimal value 0x25. Line 1, position 2.
- Report from 'XML Schema' is 'Name cannot begin with the '%' character, hexadecimal value 0x25. Line 1, position 2.'.


What the hell am I doing wrong here?

wwb
Aug 17, 2004

It seems like your local host is not interperting asmx pages as asp.net; it is just returning the text. Browse to the file manually and see what the dealie is.

@Yaksha: see my post a few above. They make a tool for exactly your situation. Use it.

Yaksha
Jun 28, 2005

Demilich

wwb posted:

@Yaksha: see my post a few above. They make a tool for exactly your situation. Use it.

Ugh, thanks, I glanced over it before but I thought it said it was something that a hosting provider setup to allow customers to use.

I was able to get all my database information, now I just need to track down a few errors that have cropped up after uploading the site. Thanks!

Darn Cotts
Mar 12, 2004

\Job"ber*nowl`\, n. [OE. jobbernoule, fr. jobarde a stupid fellow; cf. E. noll.] A blockhead. [Colloq. & Obs.]
I've got an unbound DataGridView that I'm populating programatically in a PopulateGrid() method. Once it's finished populating the table, I want to select a specific cell and put it in edit mode. I've tried doing this after the PopulateGrid() method completes, but that doesn't work (BeginEdit() returns false). Then I noticed that at some unknown time after PopulateGrid() finishes, a SelectionChanged event fires. I tried selecting/editing the cell in response to this event, but to no avail.

Pleaaaaaase help, this is driving me absolutely insane. God I hate the DataGridView control.

Edit: Never mind, fixed it. I still hate DataGridView with a passion though.

Darn Cotts fucked around with this message at 15:54 on Mar 8, 2007

Dromio
Oct 16, 2002
Sleeper
I'm looking for a bit of advice:

I have a routine that reads an XML fragment and returns a data structure. This routine is run several times a second. The fragment is very small.

Currently, I'm using an XMLReader to read the fragment and interpret it because I thought it would be better than loading and unloading a DOM several times a second.

However, the fragments aren't always consistant. Sometimes they might be missing an element, so I have to catch an error and continue on. And now I suddenly came across an issue where some elements were in the wrong order!

code:
<Fragment>
  <Title>Test Title 1</Title>
  <URL>[url]http://www.site.com[/url]</URL>
  <Owner>John Doe</Owner>
</Fragment>
vs

code:
<Fragment>
  <Title>Test Title 2</Title>
  <URL>[url]http://www.site2.com[/url]</URL>
</Fragment>
and now even

code:
<Fragment>
  <URL>[url]http://www.site3.com[/url]</URL>
  <Title>Test Title 3</Title>
</Fragment>
Should I re-write using XMLDocument to parse or am I right in worrying about the performance? Catching exceptions isn't great either.

poopiehead
Oct 6, 2004

You can just read through the stream. When you see one of the nodes you're concerned with, figure out which one they are and then get the text.

edit: this is what I mean:

code:
       enum Status
        {
            Waiting,
            Title,
            URL,
            Owner
        }

        static void Main(string[] args)
        {
            System.Xml.XmlReader reader = System.Xml.XmlReader.Create(@"C:\test.xml");

            Status theStatus = Status.Waiting;
            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                    case System.Xml.XmlNodeType.Element:
                        switch (reader.Name)
                        {
                            case "Title":
                                theStatus = Status.Title;
                                break;
                            case "URL":
                                theStatus = Status.URL;
                                break;
                            case "Owner":
                                theStatus = Status.Owner;
                                break;
                        }
                        break;
                    case System.Xml.XmlNodeType.Text:
                        switch (theStatus)
                        {
                            case Status.Title:
                                Console.WriteLine("read title = " + reader.Value);
                                theStatus = Status.Waiting;
                                break;
                            case Status.URL:
                                Console.WriteLine("read url = " + reader.Value);
                                theStatus = Status.Waiting;
                                break;
                            case Status.Owner:
                                Console.WriteLine("read owner = " + reader.Value);
                                theStatus = Status.Waiting;
                                break;
                        }
                        break;
                }

            }
            Console.Read();
        }
This falls on its face if those elements have nested elements, but seems to be ok for the kind of variation you're seeing.

That said, a DOM probably won't really hurt you with such tiny XML.

poopiehead fucked around with this message at 16:39 on Mar 8, 2007

Ethangar
Oct 8, 2002

Hey .NET gurus, need some recommendations.

I have some amazon gift certificates saved up and I figured it is time to update my programming book library a bit. I'm looking for some decent books on the following topics.

A.) A --->GOOD<--- book on WPF/WinFX (if any exist yet)
B.) Unit Testing and Class Design Practices for .NET applications (I don't care about web programming).
C.) Some book that talks about practical places to implement threading/parallelism.

Dromio
Oct 16, 2002
Sleeper

poopiehead posted:

You can just read through the stream. When you see one of the nodes you're concerned with, figure out which one they are and then get the text.

Thanks. I think I'll stick to XMLReader and make it more robust using case statements similar to your suggestion.

fankey
Aug 31, 2001

Ethangar posted:

Hey .NET gurus, need some recommendations.

I have some amazon gift certificates saved up and I figured it is time to update my programming book library a bit. I'm looking for some decent books on the following topics.

A.) A --->GOOD<--- book on WPF/WinFX (if any exist yet)

I have Applications = Code+Markup by Petzold and Programming Windows Presentation Foundation.

Most of the examples in the Petzold book are C# and not XAML. You can read on his [url=http://www.charlespetzold.com/blog/2007/03/050139.html]blog[/blog] why he chose this approach. I think his book is the better of the two but it's definitly more of a tutorial book and not a reference.

The other book I think I've cracked once or twice - since it has more XAML code I used it to figure out some XAML based databinding. There isn't much C# based code in the book. I agree with Petzold - I think there's too much focus on the XAML part of WPF and not enough on using C#.

If you were looking for a book to help you learn WPF the Petzold book is probably the way to go.

ProfCrazynuts
Feb 26, 2004
I am new to .NET so this may be a bit remedial.. When working with a project, it looks like the developer has the option to use an .mdf file or connect directly to an SQL server for data sources. When and why would you use and .mdf file over connecting directly to a database?

wwb
Aug 17, 2004

First, the biggest answer is that the app generally should not care if it is connecting to a local MDF file or a Sql Server in Katmandu. That should all be handled by a connection string a configuration file, and the app should just be speaking sql.

As for when to use an MDF, I have not found an occasion to. But I am usually working with dedicated Sql Servers and such so I don't really have the need to use MDF files. I think they make alot of sense when wants to be able to package some data to deploy with the application and such, and for folks in shared hosting situations.

Fastbreak
Jul 4, 2002
Don't worry, I had ten bucks.

ProfCrazynuts posted:

I am new to .NET so this may be a bit remedial.. When working with a project, it looks like the developer has the option to use an .mdf file or connect directly to an SQL server for data sources. When and why would you use and .mdf file over connecting directly to a database?

To break it down a bit more, basically an MDF will be distributable. I think it requires SQL express, but you can wrap that into an installer. Using a straight SQL connection is for your more robust projects.

Is that what you were looking for?

Darn Cotts
Mar 12, 2004

\Job"ber*nowl`\, n. [OE. jobbernoule, fr. jobarde a stupid fellow; cf. E. noll.] A blockhead. [Colloq. & Obs.]
Yet another problem with the loving DataGridView control. Seriously, this control is singlehandedly making me reconsider my career as a programmer. Anyway.

I have an unbound DataGridView and when the user edits a value in one of the columns I automatically re-sort the data. After it has been re-sorted, I want the address of the current cell to remain what it was before. So, if you're editing row 5, column 2, and you hit enter, I would like it to re-sort the table and then return to row 5, column 2 (even if it has a new value in that cell) - still in Edit Mode.

It's driving me absolutely insane. I'm recording the address of the current cell before I call Sort. Then, on the Sorted event, I am doing CurrentCell = Rows[ y ].Cells[ x ]; (where x and y are the original position of the cell whose edit triggered the sort). Stepping through with the debugger shows that this works, and the correct cell is selected. However, after all my code has finished running, the cell below the cell that was being edited (so x, y+1) becomes the current cell. I absolutely cannot find out what is triggering this change, nor how to stop it. Please help!

Edit: FIXED IT!! Stupid cunting control.

Darn Cotts fucked around with this message at 02:02 on Mar 9, 2007

ProfCrazynuts
Feb 26, 2004

Fastbreak posted:

To break it down a bit more, basically an MDF will be distributable. I think it requires SQL express, but you can wrap that into an installer. Using a straight SQL connection is for your more robust projects.

Is that what you were looking for?

Yes, sir. So you actually have to have sql express installed for you .NET apps to work with .mdf files?

wwb
Aug 17, 2004

Yes. They are basically a creative solution to dynamically mapping sql database instances to files on the fly.

If you need a fully transportable, small-scale, low-security data solution, an MS Access file and OleDb is actually a very dheap and effective solution. Probably better in some ways is an embedded SqlLite instance.

In any case, remember that MDF or real Sql instance, your application should not really care in most cases. It is just talking to whatever database it is provided by the connection string in the configuration.

fankey
Aug 31, 2001

Is there a way to determine whether or not a call to GetObjectData is due to file serialization or to placement in a DataObject to be placed in the clipboard. Some fields of the class I'd like stored to disk but not stored to the clipboard for a copy/paste operation. The StreamingContext passed into GetObjectData doesn't change between the two calls.

Daddy Fantastic
Jun 22, 2002

For the glory of FYAD
I'm using this code to draw a custom background for a WinForm:
code:
private void InitializeComponent()
{
    ...
    this.TransparencyKey = this.BackColor;
    ...
}

protected override void OnPaint( PaintEventArgs e )
{
    base.OnPaint( e );
    Graphics graphics = e.Graphics;
    Bitmap background = GUITools.Properties.Resources.NotificationWindow;
    graphics.DrawImage( background, new Point( 0, 0 ) );
}
This works fine, except that the PNG image uses alpha transparency around some curved edges, and you can see the form background color around these edges. Any ideas?

JediGandalf
Sep 3, 2004

I have just the top prospect YOU are looking for. Whaddya say, boss? What will it take for ME to get YOU to give up your outfielders?

Daddy Fantastic posted:

I'm using this code to draw a custom background for a WinForm:
code:
private void InitializeComponent()
{
    ...
    this.TransparencyKey = this.BackColor;
    ...
}

protected override void OnPaint( PaintEventArgs e )
{
    base.OnPaint( e );
    Graphics graphics = e.Graphics;
    Bitmap background = GUITools.Properties.Resources.NotificationWindow;
    graphics.DrawImage( background, new Point( 0, 0 ) );
}
This works fine, except that the PNG image uses alpha transparency around some curved edges, and you can see the form background color around these edges. Any ideas?
Can you not set the background image as a part of the Winform properties? I remember experimenting with background images on forms.

Daddy Fantastic
Jun 22, 2002

For the glory of FYAD

JediGandalf posted:

Can you not set the background image as a part of the Winform properties? I remember experimenting with background images on forms.
You can, but it does an even worse job of handling alpha transparency.

Here's the image; you can see there's a partially transparent black border around it. When I set it as the form's background, there's no alpha transparency drawn; the border is 100% black. When I use OnPaint, the border is drawn with the correct transparency, but there's a ring of white color around the edges before it's 100% transparent.

Only registered members can see post attachments!

Daddy Fantastic fucked around with this message at 21:43 on Mar 9, 2007

Darn Cotts
Mar 12, 2004

\Job"ber*nowl`\, n. [OE. jobbernoule, fr. jobarde a stupid fellow; cf. E. noll.] A blockhead. [Colloq. & Obs.]
I'm developing a web service. Every time I start running it to debug it (using the ASP.Net development server thing that VS2005 automatically launches) the first request takes AGES to execute. It's fine after that. Is there any way to stop this from happening? It's making debugging a real chore.

wwb
Aug 17, 2004

Not really, save getting a faster computer. The ASP.NET team made a fundamental decision to incur a large first hit penalty so that things can go alot faster afterwards.

That said, any web service really should be a simple wrapper around a normal, testable plain ole .NET library. So one could do a bit of unit testing on the underlying library minimizing the amount of pain one has to incur waiting for web processes to spin up.

Adbot
ADBOT LOVES YOU

Darn Cotts
Mar 12, 2004

\Job"ber*nowl`\, n. [OE. jobbernoule, fr. jobarde a stupid fellow; cf. E. noll.] A blockhead. [Colloq. & Obs.]
Oh please someone help me before I go completely insane!

I'm quite familiar with .Net and C# in general, but I've never used ASP.Net before and I'm completely overwhelmed by it. I've Googled endlessly for stuff, but I can't find anything that answers some really basic questions I have about what's going on and how you're supposed to make pages in ASP.Net.

I am trying to make a Registration page that has various different input boxes and stuff. It should validate the input, and if it's okay then post a registration request off to my web service and take the user to a "Registration complete" screen. So I made my form, added a Submit button and a load of validation controls and it seemed to work nicely. Then came the problem that I had no idea where to put the actual code that fires in response to the form being submitted.

Page_Load seemed an okay choice, so I checked IsPostBack in there and if it was true then I send the request off to the web service. This seemed to work nicely, until I added a custom server-side validation control, which then wouldn't work at all. Having read up on the typical page lifetime, I get the impression that Page_Load isn't the right place to put my code that runs in response to the form being submitted. But I'm completely out of ideas as to where else to put it.

Can anyone point me in the right direction?

  • Locked thread