Blog Archive

Search Blog

Blog List

Contact Me






Enter the code shown above in the box below
Send

 

Announcements

Recommended Websites

Events

Event StartEvent EndTitle

Recommended Reading

Most recent blog entries

Say you had a GridView with a dropdownlist like this:

asp:GridView ID="testGridView" runat="server">

Columns>

asp:BoundField DataField="TestField" />

asp:TemplateField>

ItemTemplate>

asp:DropDownList ID="TestDropDownList" runat="server" AutoPostBack="true">

asp:ListItem Value="1">Item 1asp:ListItem>

asp:ListItem Value="2">Item 2asp:ListItem>

asp:DropDownList>

ItemTemplate>

asp:TemplateField>

Columns>

asp:GridView>

 

And you set it’s datasource in the page load event like this:

ProtectedSub Page_Load(ByVal sender AsObject, ByVal e As System.EventArgs) HandlesMe.Load

If Not Me.IsPostBack Then

Dim testTable As New DataTable

Dim testColumn As New DataColumn

testColumn.ColumnName = "TestField"

testColumn.DataType = GetType(String)

testTable.Columns.Add(testColumn)

Dim testRow As DataRow

testRow = testTable.NewRow

testRow.Item("TestField") = "Item...

Read More »

If you want to get a list of the current objects private fields you can do so like this:

me.GetType.GetFields(system.Reflection.BindingFlags.Instance or Reflection.BindingFlags.NonPublic)

If you get this error message when running an ASP.NET unit test in VS Team System 2005:

 

The web request 'http://localhost:19298/' completed successfully without running the test. This can occur when configuring the web application for testing fails (an ASP.NET server error occurs when processing the request), or when no ASP.NET page is executed (the URL may point to an HTML page, a web service, or a directory listing). Running tests in ASP.NET requires the URL to resolve to an ASP.NET page and for the page to execute properly up to the Load event. The response from the request is stored in the file 'WebRequestResponse_lnkGetMoreWork_Click.html' with the test results; typically this file can be opened with a web browser to view its contents.

 

Remove these lines/attributes from the unit test method declaration:

 

HostType("ASP.NET"), _

AspNetDevelopmentServerHost("%PathToWebRoot%", "/"), _

UrlToTest("http://localhost/")> _

 

...

Read More »