Friday, March 9, 2012

unable to find the requested .net framework data provider. it may not be installed. sql ce 4.0

unable to find the requested .net framework data provider.
it may not be installed. sql ce 4.0
this error with asp.net mvc music store example.
you have install
in web.config


Monday, March 5, 2012

File Type Filter FileUpload Control

File Upload File Type Filter With ASP.NET
File Upload File Type Filter is not available in asp.net.
There is one way using that we can achieve our goal that is
File Dialogue of Window Desktop Application can filter type but is working only one window7, window xp or
other Microsoft OS only that is not working with Mac,Linux based system for we need to study their file system.  so that is not easy way.

Friday, February 24, 2012

GridView Show Footer And Header No Record in Grid

When No Record in Grid view at that time show Header and Footer.
only we add on Row in Dataset.

GridViewNoRecord.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="GridViewNoRecord.aspx.cs" 
Inherits="GridViewNoRecord" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>GridView Show Footer And Header No Record in Grid</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h1>
<a href="http://aspdotnet-example.blogspot.com/">http://aspdotnet-example.blogspot.com
</a>
</h1>
<h1>GridView Show Footer And Header No Record in Grid</h1>
<asp:GridView ID="gridView" runat="server" AutoGenerateColumns="false" DataKeyNames="MetalId"
EmptyDataText="No Data Found." PageSize="10" CellPadding="4" ForeColor="#333333"
GridLines="None" Style="margin-right: 0px" AllowPaging="True">
<RowStyle BackColor="#EFF3FB" />
<Columns>
<asp:BoundField DataField="MetalName" HeaderText="GridView Name" ReadOnly="True"
SortExpression="MetalName" />
<asp:BoundField DataField="Status" ItemStyle-HorizontalAlign="Center"
 HeaderText="Is GridView Active?"
ReadOnly="True" SortExpression="Status" />
</Columns>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#2461BF" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
</div>
</form>
</body>
</html>
GridViewNoRecord.aspx.cs 
using System;
using System.Linq;
using System.Web.UI.WebControls;
using System.Data;

public partial class GridViewNoRecord : System.Web.UI.Page

{

    LogicLayer objLogicLayer = new LogicLayer();

    protected void Page_Load(object sender, EventArgs e)

    {

        if (!Page.IsPostBack)
        {

            FillGridView();

        }

    }

    protected void FillGridView()

    {

        if (objLogicLayer.ListMetals().Tables[0].Rows.Count != 0)

        {

            gridView.DataSource = objLogicLayer.ListMetals();

            gridView.DataBind();

        }

        else

        {

            BuildNoRecords(gridView, objLogicLayer.ListMetals());

        }

    }
     public void BuildNoRecords(GridView gridView, DataSet ds)
    {

        try

        {

            ds.Tables[0].Rows.Add(ds.Tables[0].NewRow());

            ds.Tables[0].Rows[0][1] = "No Records Found.";

            gridView.DataSource = ds;

            gridView.DataBind();
}

        catch (Exception ex)

        {

        }

    }

}
GridView Show Footer And Header No Record in Grid