Asp .Net Ajax Videos
Asp.Net Ajax II : TextBoxWatermarkExtender
Asp .Net Ajax III : ConfirmButtonExender
Asp .Net Ajax III : SliderExtender
Asp .Net Ajax V : MaskEditExtender
Asp .Net 2.0 Membership Vidoes
Asp.Net 2.0 Membership I : LoginStatus LoginName
ASP.Net 2.0 Membership II : LoginView Control
ASP.Net 2.0 Membership III - CreateUserWizard
ASP.Net 2.0 Membership IV Roles
aspnet_regsql : Adding Membership tables to Sql Server
WPF
WPF I : Button - Shalvin
Asp .net State Management
Asp .Net Query String
ASP.Net (VB.Net) Session Variable ArrayList
Asp .Net Profile
Asp .Net Controls
Asp.Net I : Introduction and Button Control
ASP.Net Controls - II : TextBox
Asp.Net III : ListBox Inline Page Mode IsPostBack
Asp.Net IV : Label AssociateControlId AccessKey
Implementing Date Selection Functionality using Multiple Combo Boxes
C#
String.Format
C# Error Handling - Shalvin P D
VB .Net
VB.Net 2008 Controls III :ListBox
VB .Net 2008 Controls V : NumericUpDown
VB .Net 2008 Controls VI : Simple Calculator
Google Videos
Creating Window Service in C#
C# (Windows Forms) MultiThreading
WPF Creating Class C#
Ado .Net
Introduction to Ado .Net
Ado .Net ExecuteScalar
Asp .Net
Displaying DataReader Contents in a RadioButtonList
Asp.Net (VB.Net) DropDownList DataTextField DataValueField
Asp.Net (VB.Net) Displaying DataReader contents in a RadioButtonList
ASP.Net DataList HyperLink with Wizard
FileUpload Control
Asp.Net C# DataSet GridView
ASP.Net (C#) Tracing
Asp .Net 2.0 Membership videos
ASP.Net Membership Authentication, Authorization and Role based security
Asp.Net 2.0 Membership V Denying Anonymous users
Asp.Net 2.0 Membership VIII Protecting a folder
C# Windows Forms
PrintDocument and PrintPreview Control
Gdi+
I : DrawString DrawLine
II : FillRectangle FillEllipse
III : Custom Pen
IV : HatchBrush
V: Color.FromArgb
VI :ScreenSaver : Random Class and Timer Control
VII : Working with Bitmaps
Gdi+ (ASP.Net) XII : Bitmap DrawString
Multithreading and Miscellaneous
Multithreading in Windows Forms
Code Access Security
Compression and Decompression in .Net
Win32 Api Visual Basic 6 : SwapMouseButton
Reflection in .Net : Displaying all properties, methods and events of a type
Xml
XmlDocument in VB .Net
Extracting xml from Sql Server tables
Sql Server
Sql Server 2005 : Creating Tables and Relationships (Sql)
Sql Server WHERE Clause and Stored Procedures
Web Service
Creating and consuming Web Service
Web Parts
Asp .Net Web Parts : Design Mode and Brose Mode
Thursday, June 26, 2008
My .Net Videos in Youtube/Google videos
Wednesday, June 18, 2008
Query String Asp .Net : Working with multiple values
Query string is the part of URL that can be used to send data as parameters.
Let's first analyze the query string generated by Google on making a search for 'Shalvin'
http://www.google.co.in/search?hl=en&q=Shalvin.Here two values are passed as query string.
Create a Web site with two web pages.
In the button click of Default.aspx write the following code:
protected void sumButton_Click(object sender, EventArgs e)
{ Response.Redirect("Sum.aspx?Val1=" + txtVal1.Text + "&Val2=" + txtVal2.Text); }
Here is the code for extracting the value in the second page.
protected void Page_Load(object sender, EventArgs e) { Response.Write("Hello " + Request.QueryString["Name"] + " your blog is " + Request.QueryString["Blog"]); }Calculator
<body>
<form id="form1" runat="server">
<div>
Value 1<asp:TextBox ID="txtVal1" runat="server"></asp:TextBox>
<asp:CompareValidator ID="CompareValidator1" runat="server"
ControlToValidate="txtVal1" ErrorMessage="Value cannot be string"
Operator="DataTypeCheck" Type="Integer"></asp:CompareValidator>
<br />
<br />
Value 2<asp:TextBox ID="txtVal2" runat="server"></asp:TextBox>
<asp:CompareValidator ID="CompareValidator2" runat="server"
ControlToValidate="txtVal2" ErrorMessage="Value cannot be string "
Operator="DataTypeCheck" Type="Integer"></asp:CompareValidator>
<br />
<br />
<asp:Button ID="sumButton" runat="server" onclick="Button1_Click" Text="Button" />
</div>
</form>
</body>
Default.aspx
protected void Button1_Click(object sender, EventArgs e)
{ Response.Redirect("Sum.aspx?Val1=" + txtVal1.Text + "&Val2=" + txtVal2.Text); }
Sum.aspx
int i, j, res;
protected void Page_Load(object sender, EventArgs e)
{
i = Int32.Parse(Request.QueryString["Val1"]);
j = Int32.Parse(Request.QueryString["Val2"]);
res = i + j;
Response.Write(res.ToString());
}
Related Blog
ASP.Net 2.0 Profile
Friday, February 8, 2008
ASP.Net Profile
Profile is a ASP.Net 2.0 State Management option.
The greatest drawback with other state management options like Query String, Session Variable, Cookie and ViewState is lack of intellisense, which is the cause for hard to track bugs.
For example if you define a QueryString called Name in Default.aspx and refer to the same as Nam in Welcome.aspx, you won't get an error message instead a new QueryString variable called Nam will be created so obviously unpredicted result.
Profile supports intellisense.
Profile is strongly typed and you can specify default value.
Start out be creating Profile propertis in web.config
Make sure you run the application before using the profile properties.
You will get intellisense of Profile properties.
//Default.aspx
protected void btnSubmit_Click(object sender, EventArgs e)
{
Profile.Name = txtName.Text;
Profile.Blog = txtBlog.Text;
Profile.Rate = 400 + 100;
Response.Redirect("Welcome.aspx");
}
Here note that we are not assigning value to Specialization Profile property and we can apply arithmetic operations on Rate Profile property since its type is Int32.
We are accessing the value in Welcome.aspx
//Welcome.aspx
protected void Page_Load(object sender, EventArgs e)
{
Response.Write(String.Format("{0} 's blog is {1} specializing in {2} hourly rate is {3} INR", Profile.Name, Profile.Blog, Profile.Specialization, Profile.Rate ));
}
Group of Personalization Properties
lt;profile>
<properties>
<group name ="Person">
<add name ="Name"/>
<add name ="Location"/>
</group>
</properties>
</profile>
//Default.aspx
protected void btnSubmit_Click(object sender, EventArgs e)
{
Profile.Person.Name = "Shalvin";
Profile.Person.Location = "Kochi";
Response.Redirect("Welcome.aspx");
}
//Welcome.aspx
protected void Page_Load(object sender, EventArgs e)
{
Response.Write(String.Format("I am {0} my location is {1}", Profile.Person.Name, Profile.Person.Location));
}
>aspnet_reqsql -E -S .\shalvin -d ShalvinProfile -A p
<connectionStrings>
<add name="ShalvinProfileConnectionString"
connectionString="Data Source=.\shalvin;Initial Catalog=ShalvinProfile;Integrated Security=True"
providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider"
type="System.Web.Profile.SqlProfileProvider"
connectionStringName="ShalvinProfileConnectionString"/>
</providers>
<properties>
<add name="Name"/>
</properties>
</profile>
</system.web>
Related Blog