August 26, 2009 at 9:06 am
Let me preface this by saying that I do very little with web applications but since the world is obviously moving there, "when in Rome......"
Tools- Visual Studio 2008 Web Application, Dot Net 3.5, SQL Server 2K5 & 2K8
This an intranet application that will use a table to control access to user jobs (defined by category in msdb). This will be on every server. I need a drop down list of all servers (I got that easily enough) and a form to Add, Delete, update a table in the DBA database. I used a Gridview and FormView in an UpdatePanel for the table maintenance. DBAs will select a server from the DDL and the grid should then be populated based on the server name. I've got the DDL and the grid/form but can't seem to link the two. I have tried using the SelectedIndexChanged Event in the VB code to change the connection string property, Data Source, but it only works the first time there is a selection from the DDL. In debug, the event is firing properly with the selected server on every change but the grid/form doesn't refresh with data from that server. Any suggestions will be greatly appreciated.
MG
"There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies."
Tony Hoare
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
August 26, 2009 at 10:28 am
I do not believe that you can change the connection-string while you are still connected. you will probably need to disconnect it first, or just re-create it first.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
August 26, 2009 at 11:41 am
Thanks. I do that very thing in another web app that uses a couple of different frames. The actual SQLDATASOURCE is in the vb code so I can manipulate that. I was trying to "upgrade" by putting it all on one page with multiple panels. There is porbably a way to put it in the codefile but it may take longer to find that than re-write. 🙁
MG
"There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies."
Tony Hoare
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
September 3, 2009 at 9:13 am
I actually got this working for the most part. Selecting from the DDL causes a postback so in the page_load event I call a sub that changes the connection string, reassigns (don't know if that is proper terminology for it) the data source to the grid and binds the data from the new connection to the grid.
The issue now is the grid view itself. Once you start "mucking about" with the grid in code rather than what is created by the control in the declarative page, the Edit/Update needs to be handled in code. Since this is 3.5, the gridview control is a bit different from 2.0 and there isn't very much info on it that I could find. I've got everything working except resetting the row being updated back to read only mode after the update. It stays in edit mode. I found the KeepInEditMode property and set it false in the GridViewUpdated event (the only place it is available which makes sense) but it has no effect. Oh well, guess I'll be reading a lot more blogs and articles ! 😀
MG
"There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies."
Tony Hoare
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply