Contents tagged with VB.NET
-
How to Make a Heat Map Chart - VB.NET Telerik RadChart Heatmap Project Using Gantt in Code Behind
This project uses VB.NET, 3.5 Framework, and was created using Visual Studio 2008. If you do not own Telerik, please download and install the Telerik free trial.
-
ASP.NET Security Vulnerability Error Handling Project Part 3 - Sending Mail MailMessage()
Added note: A patch has been created. See Scott Guthrie's post here.
-
ASP.NET Security Vulnerability Error Handling Project Part 2
Added note: A patch has been created. See Scott Guthrie's post here.
-
ASP.NET Security Vulnerability Error Handling Project Part 1
Added note: A patch has been created. See Scott Guthrie's post here.
-
Concatenating the IN Clause using Oracle with Composite Keys
Most .NET developers are familiar with how to concatenate fields in SQL Server 2008:
-
Nested Repeater AddHandler ItemCommand Not Firing
For those of you who program mostly in code behind, like I do, I have a gotcha for a nested repeater addhandler.
The nested repeater is defined in the code in front:
<asp:Repeater ID="repTestKeyControl" runat="server">
Your nested repeater contains a button that needs to fire a click event, so you add a "CommandName."
<asp:Button ID="btnEdit" runat="server" Text="Edit" CommandName="cmdEdit" />
In the codebehind, you typically retrieve your nested repeater and add the handlers:
Dim repTestKeyControl As Repeater
repTestKeyControl = CType(e.Item.FindControl("repTestKeyControl"), Repeater)
AddHandler repTestKeyControl.ItemCommand, AddressOf repTestKeyControl_ItemCommand
AddHandler repTestKeyControl.ItemDataBound, AddressOf repTestKeyControl_ItemDataBound ' programmatically add the handler...
repTestKeyControl.DataBind() ' handlers must go before databind
You setup your ItemCommand:
Protected Sub repTestKeyControl_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs)
If e.CommandName = "cmdEdit" Then
End If
End Sub
But it doesn't fire. Your ItemDataBound fires, so why not the ItemCommand?
I mean, typically a non-nested repeater uses this event and it triggers via the Handles modifier:
Protected Sub repTestKeyControl_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs) Handles repTestKeyControl.ItemCommand
So why not a nested repeater? Well, I don't know why, but I know how to fix it. Add the handler in the code-in-front via the "OnItemCommand":
<asp:Repeater ID="repTestKeyControl" runat="server" OnItemCommand="repTestKeyControl_ItemCommand">
Now it works. Go figure. Hope that helps at least someone. -
Programmatic Menus: Optimize Your Menus in Code-behind
In this article, I want to show how you can setup your menus in code-behind and avoid redundancy. I recently inherited a web application with the menu system setup in the code-in-front. Each menu shared identical values, other than the visibility. Notice that numerous properties are defined more than once, above and below the MenuItems. What's as bad is that this entire block of code was repeated for 6 additional menus.
Example of Redundant, Bloated Menu Setup -
VB.NET to C# Conversion Hints, Tips and Gotchas
If you're a VB.NET developer learning C# or converting your VB code to C#, here are a few hints, tips and gotchas.
-
Section 9: C# and VB Project: Using our TableAdapters, DataTables and Intellisense
In our final Section 9 of this tutorial by Nannette Thacker, we learn how to use our TableAdapters within our code. We also look at how Intellisense makes it easy to set up your TableAdapter code.
-
Section 8: C# and VB Project: Using an OleDbDataReader to Retrieve Our Data
In Section 8 of this tutorial by Nannette Thacker, we take a look at adding a OleDbDataReader and the ExecuteReader method to retrieve data from an Excel Spreadsheet.