Thursday, January 29, 2009

I wanted to become a model.

Well, it seems to be the title of a movie "I wanted to become a model".Yes it is true that I wanted to become a model but destiny had something else in store for me.I wanted it because of my 6'2" height and my physique,I wanted to walk the ramp but here I am sitting in front of my laptop for hours.But the most interesting part of it is that I am very very happy.........Yes I am, with what I am doing now.

Monday, October 29, 2007

How to make a TreeView Control in ASP.Net 1.1 and populate it from the database.

As Treeview control is not a control in ASP.Net1.1 so we have to use a third party control, to compensate for that.
The following article will help you in that:-
Downloaded Web-Controls from one of links below:

1)http://msdn.microsoft.com/library/default.asp?url=/workshop/webcontrols/behaviors/library/treeview/treeview.asp
2)http://msdn.microsoft.com/archive/en-us/samples/internet/asp_dot_net_servercontrols/webcontrols/(This has the installable).

a)After running the installable, we get a folder named IE Web Controls in
C:\Program Files.
b)Then execute the Build.bat file ( A folder named Build will be created).
c)Copy the dll to your Project Bin Folder.
d)Since we have already copied the Web Control(dll) to our Project Folder(BIN)
e)In the Solution Explorer(.net) add a new Reference, a Dialog Box will open.
Browse to the Microsoft.Web.UI.WebControls (which is residing in the BIN folder
of your current project)by clicking the Browse Button.
f)Now create a folder named webctrl_client under c:\inetpub\wwwroot and under
webctrl_client create a folder named 1_0.
g)In the folder 1_0 copy the content of the Runtime under C:\Program Files\IE Web
Controls\build.

Now you are ready to use the Treeview control in your Project.
Add the following namespaces in your webpage where you shall be using the treeview control:
import namespace="Microsoft.Web.UI.WebControls"
Register TagPrefix="Treeview1" Namespace="Microsoft.Web.UI.WebControls"
Assembly="Microsoft.Web.UI.WebControls"

Add the following tag in the HTML part:
VIEW1:TREEVIEW id=Treeview1 runat="server" Width="194px" Height="185px" BackColor="LavenderBlush" BorderStyle="Ridge" AutoPostBack="True" ExpandLevel="1" Enableviewstate="true" onselectedindexchange="cal" NAME="Treeview1">Populating the Treeview Control from the database:
Write the following in Public Fuction Cal()
Create a new node for the tree-
Dim node as TreeNode()
chan_desc=DS1.Tables("Channel").Rows(i).item("channel_desc")
chan_id=DS1.Tables("Channel").Rows(i).item("channel_id")
node.Text=chan_desc
node.Id=chan_id
noder.Nodes.Add(node)

Repeat the above steps to add as many nodes you want.
The next node will be added by-
node.Nodes.Add(node1)

That is it, now you are ready to incorporate Treeview Control in ASP.Net 1.1.

Thursday, October 18, 2007

Using StyleSheets in asp.net.

If you are a novice, how will you design your pages in asp.net.You will choose the colors, font and all the other designing aspects from the properties box of that particular web control.But do you think that this is a nice idea.No, it is not.
For making it easy, generous and to bring a uniformity to our application, we use style sheets.
Using style sheets is a comman way of designing our webforms.

So, how to use them in asp.net. This is the way:-
Steps:
1)Add the following tag in the HTML part of your page -
link rel="stylesheet" type="text/css" href="styles/style.css"

Note: I have used it within the 'HEAD' tag.
2)Create a new folder--- styles in under your project.
3)Within that folder, create a .css file - Style.css(Add new item)
4)Add some classes in that .css file like:-

.defaultTxt{font-family : Verdana, Arial, sans-serif ;
font-size:34px;
background-color:Black;}
5)Save it.
6)Now to use these style format in a button control:-
For example-
asp:button id="Button1" cssclass="defaultTxt" runat="server" text="Button"

That is the simplest and easiest way to use style sheets in your code.

Tuesday, September 11, 2007

Installing an Assembly in the Global Assembly Cache.

The steps are follows:-
1)Create a Class Library project in VS.net and name it as GACShow.
2)Generating a public name:
To generate this cryptographic key pair use the SN tool.This tool is located in the \bin subdirectory where the .net framework Software Development Kit(SDK) is installed.
The command-line statement takes the following :
form:sn -k "[DriveLetter]:\[DirectoryToPlaceKey]\[KeyName].snk"
3)Create a directory named GACKey in the C: drive so that you can easily locate and access the key from the command prompt.
Note: For most users, the .NET tools are located in C:\Program Files\Microsoft.NET\FrameworkSDK\Bin. Before you type the following SN command, you may want to copy this similar path on your computer to the .NET bin directory. Type cd from the command prompt, right-click to paste the path, and then press ENTER to quickly change to the directory where the SN Tool is located.
Type the following:
sn -k "C:\GACKey\GACkey.snk"
4)Placing the KeyFile into the Assembly:
A key is generated, but it is not yet associated with the assembly of the project. To create this association, double-click the AssemblyInfo.cs file in Visual Studio .NET Solution Explorer. This file has the list of assembly attributes that are included by default when a project is created in Visual Studio .NET. Modify the AssemblyKeyFile assembly attribute in the code as follows:
[assembly: AssemblyKeyFile("C:\\GACKey\\GACKey.snk")]
5)Compile the project by clicking CTRL+SHIFT+B. You do not have to have any additional code to install a .dll file in the GAC.
6)Placing the Assemby into the GAC:
There are two ways by which you can place the assembly in the GAC-
i)You can install the .dll file by using the Gacutil Tool. If you use the Gacutil Tool, you can use the following command:
c:\>gacutil -I "[DriveLetter]:\[PathToBinDirectoryInVSProject]\projname.dll" It means that place the .dll that you can find in the bin subdirectory of your project.
ii)If you want to drag the file, use Microsoft Windows Explorer. Open two instances of Windows Explorer. In one instance, find the location of the .dll file output for your console project.
In the other instance, find c:\[SystemRoot]\Assembly. Drag your .dll file to the Assembly folder- c:\WINDOWS\Assembly

Monday, September 10, 2007

Sending Email with attachment using ASP.NET & VB.NET.

The following code can be used successfully to send email:-

Dim objEmail As New MailMessage
objEmail.To = strComm 'to whom
objEmail.From = "sumit_daripa@mindtree.com"
objEmail.BodyFormat = MailFormat.Text
objEmail.Subject = "Checking"
objEmail.Body = "Thank you for visiting my website"
objEmail.Body = "Regards-Sumit Daripa"
objEmail.Priority =MailPriority.High
Dim oAttch As MailAttachment = New MailAttachment("c:\Customer.xls")
objEmail.Attachments.Add(oAttch)
SmtpMail.SmtpServer = "indiamail.mindtree.com"
Try
SmtpMail.Send(objEmail)
Response.Write("Your E-mail has been sent sucessfully.")
Catch exc As Exception
Response.Write("Sendfailure: " + exc.ToString())
End Try