When selecting CTRL-F5 to build and run your web application in Visual Web Developer, it normally starts on the current page that is selected. This if fine if you want to only view that page in the web browser. (You can still view other pages as they are part of the build; one just has to set the browser to any other pages in the site.)
If the site is to startup at one particular page (e.g. the default or main page), select the Solution Explorer pane in Visual Web Developer. If it is not visible, select View on the top menu and select Solution Explorer (CTRL-ALT-L). A list of all the pages will be shown. Right-click on the top where your site name and path is listed. Select properties page and the select Start Options. Select Specific page and enter the page or ... to browse. Select OK.
When the site is rebuilt, it will start on the page that was selected.
Tuesday, April 29, 2008
AJAX (not the detergent)
While trying to debug the code that I copied over to my application, I tried to eliminate the AJAX toolkit used in the code because I did not have the toolkit in place on the 2008 express version of Visual Studio. I could not do this because it caused more errors than it eliminated.
I found out how to install the toolkit. The code used tabs and I wrote seperate AJAX code on another page to determine how this was done. It was simple, but I did have some problem coding the Acordion feature. It has Acordian and AcordionPane, the latter of which is a pane of the first. But I also had to find out about the properties of both because one has while the latter has . I will go into this later.
I found out how to install the toolkit. The code used tabs and I wrote seperate AJAX code on another page to determine how this was done. It was simple, but I did have some problem coding the Acordion feature. It has Acordian and AcordionPane, the latter of which is a pane of the first. But I also had to find out about the properties of both because one has
Cached Variables
I am learning. Looking for a way to pass Hazard_ID. I found out about cached variables. It seems that if I declare a session variable, I can not retrieve as a cached variable. However, if I set a variable using Cache["somevariable"] = somevalue, I can access it as a session variable.
Don't know why. I will have to further my research to determine the difference.
I have tried copying his routines including his web pages where it displays and fills the site information in lieu of passing the variable to his established page. I get multiple errors and had to address each one. I won't detail it here because there were so many.
To make a long story short, I have abandoned copying the code and pages to circumvent passing the variable. I will have to approach this another way, since my .NET coding is weak.
Don't know why. I will have to further my research to determine the difference.
I have tried copying his routines including his web pages where it displays and fills the site information in lieu of passing the variable to his established page. I get multiple errors and had to address each one. I won't detail it here because there were so many.
To make a long story short, I have abandoned copying the code and pages to circumvent passing the variable. I will have to approach this another way, since my .NET coding is weak.
Monday, April 28, 2008
Session Variables II
I came to a point where I was getting his page, but it would not have the correct site information. This meant that the session variable Hazard_ID was not being passed.
I tried adding it to the end of the URL as in http://jn-svrdev1-vma6:81/spar/csp/EditSite.aspx?Hazard_ID=number. This did not work.
Today, I set the DataKeyNames="HazardID" in the asp section of GridView (found on the page that has HTML) instead of on PageLoad() in the code section (found in the C# code behind the aspx page.
I used the following in the OnSelectedChanged and erased last week's coding:
I tried adding it to the end of the URL as in http://jn-svrdev1-vma6:81/spar/csp/EditSite.aspx?Hazard_ID=number. This did not work.
Today, I set the DataKeyNames="HazardID" in the asp section of GridView (found on the page that has HTML) instead of on PageLoad() in the code section (found in the C# code behind the aspx page.
I used the following in the OnSelectedChanged and erased last week's coding:
- int index = GridView1.SelectedIndex;
- // Display the primary key value of the selected row.
- txtHazard_ID.Text = GridView1.DataKeys[index].Value.ToString();
Session Variables
I have a grasp, somewhat, of what session variables are. They are variables defined and exist during the session while an application is running or in this case internet connection to a web site. This allows values to be passed from page to page.
The problem I was investigating was how Antoine was using Hazard_ID as a session variable. The contaminated site information would be displayed when the user selected a site from a list. A new page would be displayed based on this selection. I knew he used the Hazard_ID to find which data to fill the page, but I did not know how he accomplished this.
I was trying to use the following to do so:
GridViewRow row = GridView1.SelectedRow;
txtHazard_ID.Text = Convert.ToString(row.Cells[1].Text);
Hazard_ID = Convert.ToInt32(txtHazard_ID.Text);
GridView1 is the ID of my gridview which displays the table of my data. SelectRow returns which row was selected. row now points to the selected row of GridView1. I then convert to string the values of the second column of the selected row of data. I set Hazard_ID to this value and see if this works with his EditSite.aspx page. Hazard_ID is the session variable used to determine which site to display.
It did not work. I would get errors like "Index was out of range. Must be non-negative and less than the size of the collection." and others. I apologize for not posting on Friday. This would have documented the problems in more detail.
I then studied Antoine's EditSite.aspx code as well as his Selector.ascx page which selects the site. I borrowed more code to pass this Hazard_ID with no luck.
Some of the code is as follows:
HttpContext.Current.Session[DataKey] = GridView1.SelectedDataKey.Value;
//trip the event
OnSelectorChanged(sender, e);
txtHazard_ID.Text = Convert.ToString(GridView1.SelectedDataKey.Value);
I had to define OnSelectorChanged, DataeKey get and set, Hazard_ID set and get. In the Page_Load section I tried to set the DataKeyNames to HazardID, which is the name of my key.
It did not work.
I left Friday unsuccessful.
The problem I was investigating was how Antoine was using Hazard_ID as a session variable. The contaminated site information would be displayed when the user selected a site from a list. A new page would be displayed based on this selection. I knew he used the Hazard_ID to find which data to fill the page, but I did not know how he accomplished this.
I was trying to use the following to do so:
GridViewRow row = GridView1.SelectedRow;
txtHazard_ID.Text = Convert.ToString(row.Cells[1].Text);
Hazard_ID = Convert.ToInt32(txtHazard_ID.Text);
GridView1 is the ID of my gridview which displays the table of my data. SelectRow returns which row was selected. row now points to the selected row of GridView1. I then convert to string the values of the second column of the selected row of data. I set Hazard_ID to this value and see if this works with his EditSite.aspx page. Hazard_ID is the session variable used to determine which site to display.
It did not work. I would get errors like "Index was out of range. Must be non-negative and less than the size of the collection." and others. I apologize for not posting on Friday. This would have documented the problems in more detail.
I then studied Antoine's EditSite.aspx code as well as his Selector.ascx page which selects the site. I borrowed more code to pass this Hazard_ID with no luck.
Some of the code is as follows:
HttpContext.Current.Session[DataKey] = GridView1.SelectedDataKey.Value;
//trip the event
OnSelectorChanged(sender, e);
txtHazard_ID.Text = Convert.ToString(GridView1.SelectedDataKey.Value);
I had to define OnSelectorChanged, DataeKey get and set, Hazard_ID set and get. In the Page_Load section I tried to set the DataKeyNames to HazardID, which is the name of my key.
It did not work.
I left Friday unsuccessful.
Thursday, April 24, 2008
CSP Research
Researching the CSP application Antione is developing for information on how I can pass the Hazard_ID to be included with my database. I wish to use it to access the CSP database to lookup site specific information. I was looking in the EditSite.aspx stuff, but to no avail.
Thought a session variable named Hazard_ID would do the trick. Nope.
Then tried passing the variable in the EditSite.aspx?Hazard_ID=1294 url type. Nope.
Looked at Default.aspx, LocationAddress.aspx, and now Selector.aspx (This is the gridview where it lists the sites listed by A, B, C, etc or by search string). It contains the Select link button to direct the page to the EditSite.aspx by site selected. This should help.
I'll post the results later. Time to go home.
Thought a session variable named Hazard_ID would do the trick. Nope.
Then tried passing the variable in the EditSite.aspx?Hazard_ID=1294 url type. Nope.
Looked at Default.aspx, LocationAddress.aspx, and now Selector.aspx (This is the gridview where it lists the sites listed by A, B, C, etc or by search string). It contains the Select link button to direct the page to the EditSite.aspx by site selected. This should help.
I'll post the results later. Time to go home.
CRITTS Meeting
Very informative meeting concerning a time invoicing database application that is being developed. It is not yet ready for production, but looks like I will need to know more about it; it will relate to my database in that it tracks billing and invoicing time worked on specific projects. My database will probably need to access this information in the future. However, CRITTS will not be applied to this section until after 2009. Some major changes in the way site are tracked and billed will result. This is to be determined.
Modified GetLarrysReport Stored Procedure
I modified GetLarrysReport stored procedure to reference my Category table using CategoryID and added HazardID which was included into LarrysReport table. Category field is still in Larry's report. I will drop this column later. I want to be sure CategoryIDs match Category.
I added the column HazardID; it comes from Antoine's CSPV2 database concerning Contaminated Sites database. I will be linking to this database for all site specific data. I updated the HazardID to match his based on matching SiteDescriptions. It worked for some 270 records, I think. There are over 1700 records in my database which is still imcomplete, but it a working model.
When I get a better database going, I will incorporate all data in this program. It will still have to be edited, verified for accuracy, and some manually entered.
I added the column HazardID; it comes from Antoine's CSPV2 database concerning Contaminated Sites database. I will be linking to this database for all site specific data. I updated the HazardID to match his based on matching SiteDescriptions. It worked for some 270 records, I think. There are over 1700 records in my database which is still imcomplete, but it a working model.
When I get a better database going, I will incorporate all data in this program. It will still have to be edited, verified for accuracy, and some manually entered.
An example of a google result that dealt with my linked server error.
I googled my linked server error when I could not get the SELECT statement to work using jn-svrdev1-vma\sql2005. The error was similar to this:
I did find a useful(?) SELECT statement that might at some point help me understand the status of linked servers; but, at this point I can't interpret it. It is as follows:
- The OLE DB provider "SQLNCLI" for linked server reported an error. Authentication failed.
I did find a useful(?) SELECT statement that might at some point help me understand the status of linked servers; but, at this point I can't interpret it. It is as follows:
- select S.server_id, S.name, S.provider,S.data_source,S.provider_string, L.uses_self_credential
from sys.servers as S, sys.linked_logins as L
where S.server_id=L.server_id and S.name=N'TypeServerNameHere'
Of course, I hope you understand 'TypeServerNameHere' is actually replaced by your server name you are trying to access.
What did help me in this google result, was the last post where the guy having the problem resolved the issue by using the option "Login using this security context".
He did not state where he did this. I found in the SQL Managment Studio in my database Server Objects under Linked Server properties for the server I'm trying to link.
Here is the link to the forum posts that discuss his issue: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=990327&SiteID=1
Linking Servers in SQL Management Studio
I forgot to mention that I am working with Microsoft SQL Server Management Studio to link the two databases. I don't want to do like most and leave out critical information by assuming everyone knows the extraneous details when describing the method of working with SQL databases.
To link to SQL Server (in my case, jn-svrdev1-vma7\sql2005), I did the following:
To link to SQL Server (in my case, jn-svrdev1-vma7\sql2005), I did the following:
- I expanded the Server Objects tab located in the Object Explorer of my database.
- I then right-click Linked Servers and select New Linked Server.
- Under Select a page, select General.
- I select SQL Server
- Type in jn-svrdev1-vma7\sql2005 in the Linked server textbox.
- Under Select a page, select Security.
- Select Be made using the login's current security context
- Select Add button
- Under Local login, select your user login id
- Select OK
You should now be linked to this database.
Linking my database to another database using a linked server
I have had trouble linking to a seperate server called 'jn-svrdev1-vma7/sql2005'. Googling how to lookup a table on another server will tell you just use a simple statement like the following:
SELECT md.*, od.*
FROM myDataTable md
INNER JOIN [OtherServerName].OtherDatabaseName.dbo.OtherDataTable od
ON od.SameFieldID = md.SameFieldID
Simple enough? No, they don't explain that the 'OtherServerName' must be a linked server defined in the 'Server Objects' of your database. I will outline how to link this server in the next posting. I ran into errors trying to do this. Once you have a linked server, you can use a statement like the one above.
I have found that using the Design Query helps in this case, since saves a few keystrokes writing the statement.
SELECT md.*, od.*
FROM myDataTable md
INNER JOIN [OtherServerName].OtherDatabaseName.dbo.OtherDataTable od
ON od.SameFieldID = md.SameFieldID
Simple enough? No, they don't explain that the 'OtherServerName' must be a linked server defined in the 'Server Objects' of your database. I will outline how to link this server in the next posting. I ran into errors trying to do this. Once you have a linked server, you can use a statement like the one above.
I have found that using the Design Query helps in this case, since saves a few keystrokes writing the statement.
Subscribe to:
Posts (Atom)
