The Blog of Travis Gneiting
  • Home
KEEP IN TOUCH

Posts in category ASP.NET

Notes on SQLMembership Provider using the MembershipProvider Class

Nov15
2011
Leave a Comment Written by admin

1. Set the tag to use “forms” in the config
2. use the reg_sql to generate the SQL tables for use with SQLMembership Provider.
3. Add 4. Can use membership.createuser(“UN”,”PW”,”Email”) to create user.
5. Methods include:Createuser, ValidateUser, DeleteUser, FinduserByName,finduserByEmail,GenPassword
6.Options to capture other user info with ProfileSystem, and defining provider properties in webconfig. Or simply adding additional tables.

Posted in Membership

Table to Excel XLS code

Nov15
2011
Leave a Comment Written by admin

Dim StringWriter1 As IO.StringWriter
Dim StringBuilder1 As StringBuilder = New StringBuilder
StringWriter1 = New IO.StringWriter(StringBuilder1)
Dim TextWriter1 As HtmlTextWriter = New HtmlTextWriter(oStringWriter)
label.RenderControl(oTextWriter)
Response.Clear()
Response.ClearHeaders()
Response.ContentType = “application/vnd.xls”
Response.AddHeader(“Content-Disposition”, “attachment;filename=WLMS-exlfile.xls”)
Response.Write(StringWriter1.ToString())
Response.Flush()
Response.End()

Setting the SelectedValue of RadioButtonList & DropDownList in GridView EditItemTemplate

Jun19
2011
Leave a Comment Written by admin

Here is a trick one, because IntelliSense doesn’t bring up the “SelectedValue” property for a RadioButtonList, or a DropDownList in an EditItemTemplate for GridViews you may forget that “SelectedValue” is an actual property of these controls.

Here is how you can set the selected value of a RadioButtonList inside an EditItemTemplate

Source code   
<asp:TemplateField HeaderText="Payment">
<ItemTemplate>
    <asp:Label ID="lablePayment" runat="server" Text='<%#Eval("PayName")%>' />
</ItemTemplate>
<EditItemTemplate>
  <asp:RadioButtonList Runat = "server" ID="rblPaymentType" SelectedValue='<%#Eval("PayTypeID")%>'>
    <asp:ListItem Text="Check" Value="1"></asp:ListItem>
    <asp:ListItem Text="Credit Card" Value="2"></asp:ListItem>
  </asp:RadioButtonList>
</EditItemTemplate>
</asp:TemplateField>

Conditional Hyperlink in template

Jan11
2011
Leave a Comment Written by admin

<%

#IIf((Eval(“id”) Is System.DBNull.Value), Eval(“Last”) & “, “ & Eval(“First”), “<a href=” ../default.aspx?id=” & Eval(“id”) & “>” & Eval(“Last”) & “, “ & Eval(“First”) & “</a>”)%>

WebMethods For Use With Visual Studio and AJAX

Jan05
2009
Written by admin

The webmethod tag is an attribute added to a Public methods to indicate the method should be exposed as part of an XML Web service.  Below is an example of applying the WebMethod attribute.


<WebMethod()> _
Public Shared Function FunctionName(ByVal Parameter As String) As ObjectName
Dim ObjectName As Object = Object
Return ObjectName
End Function

The Web method can now be called via javascript on the client. Below is an example of calling the webmethod from the client.

PageMethods.FunctionName(Parameter1, onComplete, OnTimeOut, onError);

Here is a great link with additional information for web methods:

http://www.novologies.com/post/2009/05/06/Cleaner-Faster-Ajax-in-ASPNET.aspx

Posted in Javascript - Tagged webmethod

Microsoft Project Code Name “Velocity”

Sep25
2008
Written by admin

Microsoft Velocity provides distributed in-memory web application caching. This provides highly scalable, high-performance application caching. “Velocity Caching” can be used to cache any Common Language Runtime (CLR is the Virtual Machine of Microsoft’s .NET initiative) through simple API’s. From a general standpoint, Velocity was created with the goal of providing performance, scalability and availability.

The main application for providing scalable, available, high-performance applications using Velocity is by fusing the memory between multiple computers to give a single/unified cache view for the application to employ. The application can they store any CLR object that is serializable.

http://blogs.msdn.com/velocity/

Posted in Software Engineering - Tagged Velocity

A better way to get a querystring

Aug01
2008
Written by admin

If (Not String.IsNullOrEmpty(Request.QueryString("qString"))) Then qString = Request.QueryString("qString")
End if

Posted in Patterns & Practices - Tagged .net, querystring

Software Development: Patterns And Practices

Jul31
2008
Written by admin

http://msdn.microsoft.com/en-us/practices/default.aspx

http://msdn.microsoft.com/en-us/library/cc467894.aspx

http://www.codeplex.com/AppArchGuide

According to Microsoft P&P (Patterns and Practices) were created to meet the demands of architects and application developers. By following proven patterns and practices it is suggested that more sound applications will be the result. Included in P&P

  • How to design
  • Develop
  • Deploy
  • Operate architecturally sound applications on a Microsoft platform.

P&P for Web Applications
http://msdn.microsoft.com/en-us/practices/bb969054.aspx#web_apps

PHP Patterns and Practices
http://www.phppatterns.com/docs/start

Posted in Patterns & Practices, Software Engineering

ASP.NET Page and Application Tracing

Apr17
2008
Written by admin

Tracing

The tracing feature in ASP.NET is useful in tracking the execution of an application. This is helpful to display the trace in a way that doesn’t affect the programs output.

To enable tracing on a page-by-page level, set the Page directive in any ASP.NET page to True:

<%@ Page Language=”C#” Trace=”true” TraceMode = “SortByCategory” Inherits = “System.Web.UI.Page” CodeFile=”Default.aspx.cs” %>

To enable tracing for an entire application add tracing settings to the web.config:

<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<compilation debug=”false” />
<authentication mode=”Windows” />
<trace enabled =”true” pageOutput =”True” requestLimit =”20″ traceMode =”SortByTime ” />
</system.web>
</configuration>

The page-level setting will take precedence over the web.config setting.

How to view Trace Data.

In the Page_Load event call System.Diagnostics.Trace.Write(). Make sure the pageOutput=True in the webConfig.

What’s being displayed

1. Request Details
ASP.NET Session ID, Character encoding of the request.

2. Trace information
All Trace.write methods called in the HTTP request. This is helpful to find methods that are taking a long time to execute.

3. Control Tree
HTML of ASP.NET Control Tree.

4. Session State
List all keys and values for users session .

5. Application State
List all keys and values for application.

6. Request Cookies Collection
List all cookies passed in during page request.

7. Response Cookies Collection
List all cookies passed back during page response.

8. Headers Collection
Shows all headers passed in during request from browser.

9. Response Headers Collection
Shows all headers passed back during response.

10. Form Collection
Displays dump of Form Collection and all keys and values.

11. Querystring Collection
Displays dump of Querystring collection and all keys and values.

12. Server Variables
Displays dump of Server Variables with keys and values.

The Trace.axd
Page output only displays information of the current page. If you want to create a collection use Trace.axd.

http://localhost/application-name/trace.axd

Trace.axd will display all tracing data up to the present limit.

Trace Forwarding

ASP.NET allows to forward trace message to System.Diagnostics.Trace:write to DiagnosticsTrace

<trace enabled =”true” requestLimit =”20″ writeToDiagnosticsTrace =”true ” pageOutput =”true”/>

Posted in Debugging - Tagged Trace Debug ASP.NET

Programming

  • ASP.NET
  • MSDN
  • Visual Studio Offical Website
  • www.w3.org

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org

Welcome to My Programming Blog

This is my brain dump. I use it to post thing I may use again, interesting things I have run into and programming helps.

Tags

.net Agile Software Development Engineering ASP.NET attack Beginner Blueprint CSS Database Deployment DevExpress Framework Functional hacked Hotmail How to test software HTTP IIS Javascript JQuery MIME New Website Checklist PHP querystring Software Testing Specification spoof Status Codes Testing Trace Debug ASP.NET Tutorial Velocity webmethod Website Testing Zend

Blog Archive

  • January 2012
  • November 2011
  • August 2011
  • July 2011
  • June 2011
  • May 2011
  • February 2011
  • January 2011
  • November 2010
  • October 2010
  • August 2010
  • July 2010
  • May 2010
  • April 2010
  • March 2010
  • February 2010
  • February 2009
  • January 2009
  • November 2008
  • September 2008
  • August 2008
  • July 2008
  • April 2008

EvoLve theme by Theme4Press  •  Powered by WordPress The Blog of Travis Gneiting