Posts

Showing posts from February, 2013

Show excel data in gridview and insert it in database

Image
Show excel data in gridview and insert it in database Here we do upload excel using fileuploader   and then  display its data in gridview. DataBase Tables  Table creation CREATE TABLE [dbo].[excel_test]( [cust_id] [varchar](50) NULL, [city] [varchar](150) NULL, [country] [varchar](150) NULL, [post] [varchar](150) NULL ) ON [PRIMARY] .Aspx Part    <asp:FileUpload ID="FileUpload1" runat="server" />         <asp:Button ID="btnUpload" runat="server" Text="Upload" OnClick="btnUpload_Click" />         <br />         <asp:Label ID="Label1" runat="server" Text="Has Header ?"></asp:Label>         <asp:RadioButtonList ID="rbHDR" runat="server">             <asp:ListItem Text = "Yes" Value = "Yes" Selected = "True" ></asp:ListItem>           ...

Validationsin asp.net

Required Field Validations 1)for checking all Alphabetic <asp:RegularExpressionValidator ID="revtxtNewName" runat="server" Text="*" ToolTip="Enter alphabate " ControlToValidate="txtNewName" ValidationExpression="^[a-zA-Z'.\s]{1,40}$"></asp:RegularExpressionValidator> 2) for checking all Numeric <asp:RegularExpressionValidator ID="revtxtNewSalary" runat="server" Text="*" ToolTip="Enter numeric value" ControlToValidate="txtNewSalary" ValidationExpression="^[0-9]+$"></asp:RegularExpressionValidator> 2) for alphanumeric password checking     <asp:RegularExpressionValidator id="RegularExpressionValidator1"                       ControlToValidate="txtpass"                      ValidationExpression="(?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a-zA-Z0-9]{8,10})$"                    ...

working With Linq in asp.net(Insert,Update,delete,Bind gridview using LINQ)

Image
Work with Linq(language Integrated query) In asp.net This  article is about LINQ which I think is one of the most exciting features in Orcas. LINQ makes the concept of querying a first-class programming concept in .NET. The data to be queried can take the form of XML (LINQ to XML), databases (LINQ-enabled ADO.NET: LINQ to SQL, LINQ to Dataset and LINQ to Entities) and objects (LINQ to Objects). LINQ is also highly extensible and allows you to build custom LINQ enabled data providers (e.g.: LINQ to Amazon, LINQ to NHibernate, LINQ to LDAP). In this articles we mainly do insert, update ,delete ans show data in gridview using Linq. For working with Linq we initially design our page with some input controls. So lets proceed now…. Step 1: Design Database tables. Create table in your Database.. CREATE TABLE [dbo] . [GridView] (       [id] [int] IDENTITY ( 1 , 1 ) NOT NULL,       [name] [varchar] ( 50 ) NUL...

Display Document type in Gridview

Image
Display Document  type in Gridview Firstly  i want to explain Document type. In .net we normally use file up-loader for uploading file in system.it can easily upload file of any type like (word,excel,pdf.etc.....).so if we want view uploaded file content we use gridview. so its very easy to identify its doc type in gridview. For this we need to create Gridview .and inside gridview i am using a image control for display its type in thr form of picture. .aspx <asp:GridView ID="gr_doc" runat="server"  ItemStyle-VerticalAlign="Top"          ItemStyle-HorizontalAlign="Justify" AutoGenerateColumns="false"                          BorderWidth="0" CellPadding="10" CellSpacing="1"          GridLines="None" Width="100%"                  ...

Export Gridview in Word,Excel and Pdf

Export Gridview in Word,Excel and Pdf We mainly need to export data, when need to maintain its reports.So we can export data in any form  like(Word,Excel and Pdf).Its very Easy to export gridview content in any format like(Word,Excel and Pdf). For this You need  to do  some simple task like.. firstly you need to create gridview on .aspx page and populate the gridview with your data. Here i am using two control of .net Grdiview for populating data and Linkbutton for Download. For working on this you have to be download ItextSharp.dll and then deploy it in ur project BIn folder. .apsx <asp:GridView ID="gr1" runat="server" AutoGenerateColumns="false"              onrowdatabound="gr1_RowDataBound">          <Columns>          <asp:TemplateField  HeaderText="eid">     <ItemTemplate>     <asp:Label...