Geeks With Blogs
Phil Sando
Today's little problem is that I am trying to load user controls from my codebehind like so: Dim myControl As UserControl = LoadControl("~\Modules\Cont... Controls.Add(myControl) On running the page myControl is no where to be seen. I wonder why that is? Well after a bit of thought the following come to mind... Am I using the correct code to ......

I was recently introduced to Microsoft's tool that analyzes managed code assemblies called FxCop. It points out possible design, localization, performance and security improvements against a pre-defined set of rules (and also accepts custom rules). At first I was unsure how to go about using it, as it seems to be aimed at Windows developers (.exe and ......

Here is the markup for the repeater control and its templates: <asp:Repeater ID="Repeater" runat="server"> <HeaderTemplate> <table> <tr> <td colspan="3"><h2>He... information:</h2><... </tr> </HeaderTemplate> <ItemTemplate> <tr> <td><%#Container.D... ......

This is the code I use to send an email from an asp.net page: Dim message As New MailMessage() message.IsBodyHtml = False message.From = New MailAddress("foo@foo.com") message.To.Add(New MailAddress("foo@foo.com")) message.Subject = ("Response from form") message.Body = ("Email message here") Dim client As New SmtpClient() client.Host = "email.foo.foo" ......

I am starting work on some asp.net vb pages to consume and work with web services. Part 1 was to create a web form that posts xml that a dba can paste into a textbox on an aspx page. Here is the code; Imports System.Net Imports System.IO Partial Class _Default Inherits System.Web.UI.Page Protected Sub Submit_Click(ByVal sender As Object, ByVal e As ......

Here is my web.config used to login protect a folder called administration; <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.web> <customErrors mode="Off"> </customErrors> <authentication mode="Forms"> <forms name=".ASPXAUTH" loginUrl="login.aspx" protection="All" timeout="999999"> <credentials ......

This handy bit of sql code returns the last identity value inserted into an identity column in the current scope and sets its value to the parameter @ID SET @ID = SCOPE_IDENTITY() I found this a very useful thing to get to grips with and start using in my code. For further information on scope identity hit this msdn link ......

Exposing the property: Public Property stringproperty() As String Get Return _stringproperty End Get Set(ByVal value As String) _stringproperty = String.empty End Set End Property Accessing the property from a content page: You will need to add this line to your .aspx page in order to be able to access the property you just exposed @ MasterType VirtualPath ......

make sure all queries are parameterised like this: sql = ("select * from contacts where contactid = @id") Dim cmd As SqlCommand = New SqlCommand(sql, conn) cmd.Parameters.Add("@id", SqlDbType.VarChar) cmd.Parameters("@id").Value = id I also include a usercontrol which checks the querystring for bad terms: The list is long but this snippet should give ......

Here is the code you need to start adding parameters to your sql commands: Add parameter then add value: Dim cmd As SqlCommand = New SqlCommand(s,c) cmd.Parameters.Add("@id", SqlDbType.Int) cmd.Parameters("@id").Value = foo or Add parameter with value: command.Parameters.AddWithV... foo) ......

Copyright © PhilSando | Powered by: GeeksWithBlogs.net