Thursday, 31 January 2013
Tuesday, 29 January 2013
Single or multiple Image upload on ASP.NET MVC3
I spent a great time searching for an example of Upload Image on ASP.NET MVC3 web site.
These are the two simple steps you need to do. (single image)
Create the view
---------------------
<form action="" method="post" enctype="multipart/form-data">
<input type="text" name="firstName" id="firstName" />
<input type="file" name="file" id="file1" />
<input type="submit" />
*Note - Make sure the name that you give for the input type file is important
or If u are using html helper to create the form
@using (Html.BeginForm("Upload", "Home", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<input type="text" name="firstName" id="firstName" />
<input type="file" name="file" id="file1" />
<input type="submit" />
}
Wednesday, 23 January 2013
What is the difference between Parse() and TryParse()?
What is the difference between Parse() and TryParse()?
Parse method is used to parse any value to specified data type.
For example
string test = "42";
int32 Result;
Result = Int32.Parse(test);
This will work fine bt what if when you are aware about the value of string variable test.
if test="abc"....
In that case if u try to use above method, .NET will throw an exception as you are trying to convert string data to integer.
TryParse is a good method if the string you are converting to an interger is not always numeric.
if(!Int32.TryParse(test,out iResult))
{
//do something
}
The TryParse method returns a boolean to denote whether the conversion has been successfull or not, and returns the converted value through an out parameter.
**declare variable iResult of Int32.
*Parse throws an exception if it cannot parse the value, whereas TryParse returns a bool indicating whether it succeeded.
*TryParse does not just try/catch internally - the whole point of it is that it is implemented without exceptions so that it is fast. In fact the way it is most likely implemented is that internally the Parse method will call TryParse and then throw an exception if it returns false.
In a nutshell, use Parse if you are sure the value will be valid; otherwise use TryParse.
DOWNLOAD
Monday, 21 January 2013
C# developer interview questions
A representative of a high-tech company in United Kingdom sent this in today noting that the list was used for interviewing a C# .NET developer. Any corrections and suggestions would be forwarded to the author. I won’t disclose the name of the company, since as far as I know they might still be using this test for prospective employees. Correct answers are in green color.
1) The C# keyword .int. maps to which .NET type?
System.Int16
System.Int32
System.Int64
System.Int128
2) Which of these string definitions will prevent escaping on backslashes in C#?
string s = #.n Test string.;
string s = ..n Test string.;
string s = @.n Test string.;
string s = .n Test string.;
Thursday, 17 January 2013
Generatring A Report Based on Employee Name.

step1:Create a new Crystal Report --Go To Vistual Studio - File-New- Website-Name-CrystalReport1.rpt
After that we design like this.
Step2: Creating A new Web Page -- Go To Vistual Studio - File-New- Website-Name-Employee.aspx
step3:Write The Below Code in employee.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="EmployeeTimesheetEmpRpt.aspx.cs" Inherits="EmployeeTimesheetEmpRpt" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
<table widht="100%">
<tr>
<td colspan="2">
<table align="center" style="width: 100%">
<tr>
<td>
<asp:Label ID="lblEmployee" Text="Employee" runat="server"></asp:Label>
</td>
<td>
<asp:DropDownList ID="ddlEmployee" runat="server" Width="150px">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RfvEmployee" runat="server" ControlToValidate="ddlEmployee"
CssClass="failureNotification" InitialValue="-1" ErrorMessage="Please Select Employee"
ToolTip="employee is required" ValidationGroup="Timesheet">Please Select Employee</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style1" colspan="2" align="left">
<asp:Button ID="btnView" runat="server" Text="View All Employees" ValidationGroup="Timesheet" onclick="btnView_Click"
/>
</td>
<td class="style1" colspan="2" align="center">
</td>
</tr>
</table>
</td>
</tr>
</table>
</asp:Content>
Thursday, 3 January 2013
Upload Files to Database in Asp.net Download Files From Database in SQL Server
Upload Files to Database in Asp.net Download Files From Database in SQL Server
Introduction:
Here I will explain how to save or insert or upload word document files into SQL Server database and download files from database in asp.net using C#, VB.NET.
Description:
Introduction:
Here I will explain how to save or insert or upload word document files into SQL Server database and download files from database in asp.net using C#, VB.NET.
Description:
AutoComplete textbox in Asp.net by using JQuery and Webservice.
Sample Example of JQuery AutoComplete textbox in Asp.net by using WebMethod|| How to Use AutoComplete textbox in Asp.net by using JQuery and Webservice.
In this article I am showing about how to use JQuery AutoComplete textbox in Asp.net .
The following are the step to use AutoComplete textbox in Asp.net by using JQuery.
1.First design the table name Category with two fields Id,Category as follows:
In this article I am showing about how to use JQuery AutoComplete textbox in Asp.net .
The following are the step to use AutoComplete textbox in Asp.net by using JQuery.
1.First design the table name Category with two fields Id,Category as follows:
Sending SMS using Asp.net C#
To implement this concept you need to follow the below steps :
Step1 :
Create a new Asp.net website in Visual Studio and write the following html code in the design part of the Default.aspx page.
Default.aspx :
Step1 :
Create a new Asp.net website in Visual Studio and write the following html code in the design part of the Default.aspx page.
Default.aspx :
Subscribe to:
Comments (Atom)