Tuesday, August 26, 2008
Textbox submit NOW!
Good ol' Internet Explorer won't handle a button click event with a page postback form an enter key with only 1 textbox.
Solution:
1. Add an invisible textbox (as the solution from above article)
2. Put in a panel and set DefaultButton
Wednesday, August 13, 2008
Viewing the details
For custom Next/Previous/First/Last buttons:
CommandName="Page" CommandArgument="..."
[Command arguments paramters]
Yes the buttons need to be in a template of the DetailsView control, they cannot be outside. Make sure they aren't outside if they aren't working....grrrr.
To access an item in the Pager template:
DetailsView1.BottomPagerRow.FindControl("...")
In the aspx page, set the DataKeyNames to allow SQL Statements to be updated/deleted.
Cheers,
Friday, August 01, 2008
Reporting Work
Here is the best solution I was able to come up for building reports in Visual Studio 2008.
1. Create a new web application project (or open the your current project).
2. Add New Item to your project. Select a Report and give it a name. Note that these reports are rdlc not rdl. ( http://msdn.microsoft.com/en-us/library/ms252109(VS.80).aspx for information on rdlc versus rdl)
3. Now to add the dataset for the report data. Add New Item again, this time add a DataSet. This should walk you through a wizard for adding a new DataSet. Note that if you have a connection string in your web.config file to point to a database, you WILL still NEED to add a NEW connection string. It will give you servers to choose from that currently exist in the Server Explorer. Once you add a new connection string through this dataset wizard it will be avaliable for the next TableAdapter that you add. Grrrr... I'm going to stop here because I have many gripes...
4. A tableadapter for a dataset that you want for a report should now exist. Go back to the Report rdlc file (you may have to click around on the design area to get all the menu items to show up) and select Report, Data Sources..., find the DataSet that you just created and Add to Report
Now let's say you have built many reports and want to use 1 report viewer to dynamically display the reports in a report viewer. Add a new page or open an existing aspx page. Add a Report Viewer to the page. (This is were I think things get ugly, and there may be a better solution, feel free to post a comment if there is a better solution)
Report View definition on aspx page:
The code behind to have the report viewer set the report:
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Report is going to run local on the website
ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local
ReportViewer1.LocalReport.DataSources.Clear()
Dim conn As New SqlConnection(ConfigurationManager.ConnectionStrings("ReportConnectionString").ConnectionString)
Dim cmd As New SqlCommand()
cmd.Connection = conn
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "sp" & Request.QueryString("reportname") ' Build stored procedure string from an example query string
Dim sqlAdapter As Object
Dim dt As Object
' Depending on what report you want to display, you'll need to call the right table adapter, hence why they are defined as objects at first
sqlAdapter = New DataSet1TableAdapters.[NameDefinedInDataSet1]TableAdapter()
dt = New DataSet1.[NameDefinedInDataSet1]DataTable
sqlAdapter.Fill(dt)
conn.Close()
Dim Source As New ReportDataSource("DataSet1_[NameDefinedInDataSet]"), dt)
ReportViewer1.LocalReport.DataSources.Add(Source)
ReportViewer1.LocalReport.ReportPath = "Report.rdlc"
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Now if you followed that jumbled piece of code, congrats. If you're smart you'll have the name defined in the data set match up to the report name so you can use the query string (or whatever other method). You'll still need a case statement or bunch of if's for defining the sqlAdapter and dt. Also, the ReportDataSource will be looking for the specific DataSet1_[NameOfTableAdapterDefinedInDataSet].
If you are thinking what on earth?, so am I. Hence why we decided to stick with the Reporting Service Project even though the project will need to be seperate and can only be done in Visual Studio 2005.
Cheers, I'm out, and I do not want to think about this again until reporting improves for Visual Studio 2008.
Monday, July 21, 2008
Setting up WCF web service
The type of errors I was recieving:
Content Type application/soap+xml; charset=utf-8 was not supported by service
System.InvalidOperationException: An exception was thrown in a call to a WSDL export extension: System.ServiceModel.Description.DataContractSerializerOperationBehavior contract: CubeService ----> System.Runtime.Serialization.InvalidDataContractException: Type 'GraphDataClass' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute.
The problem is with the class contracts not matching and being unable to be serialized (or something along that effect)
Start by including
Imports System.Runtime.Serialization
-for examples [http://msdn.microsoft.com/en-us/library/system.runtime.serialization.datamemberattribute.aspx]
Give the class and properties the according contract information (See image below or example above)

That should allow you to add the WCF as a web service reference/fix the errors. Comment if you have questions on it, because I'm just briefly going over the problem/solution.
Friday, July 18, 2008
Silverlight: Beware of the Contract

Saturday, April 12, 2008
Monte Carlo and Reliability Engineering
http://en.wikipedia.org/wiki/Reliability_engineering
Tonight I spent sometime developing and helping a fellow friend with a vb.net application to calculate the reliability of a system using a Monte Carlo analysis. Suffice to say, I learned quite a bit (which I shall bore you with at another time). Interestingly enough, my engineering economy class covered the basic aspects of the Monte Carlo simulation. The engineering economy class focused primarily on the financial side instead of the reliability side.
As you can tell from my fragmented thoughts...I'm tired. Thus, I shall fall asleep now!