Click here to Skip to main content
12,506,280 members (55,943 online)
   

ASP.NET

 
GeneralRe: Application_Error not called for SqlException Pin
Sandeep Mewara11-Feb-13 19:55
mvpSandeep Mewara11-Feb-13 19:55 
GeneralRe: Application_Error not called for SqlException Pin
«_Superman_»11-Feb-13 22:25
member«_Superman_»11-Feb-13 22:25 
GeneralRe: Application_Error not called for SqlException Pin
«_Superman_»11-Feb-13 23:19
member«_Superman_»11-Feb-13 23:19 
GeneralRe: Application_Error not called for SqlException Pin
Sandeep Mewara12-Feb-13 3:13
mvpSandeep Mewara12-Feb-13 3:13 
GeneralRe: Application_Error not called for SqlException Pin
«_Superman_»15-Feb-13 0:28
member«_Superman_»15-Feb-13 0:28 
GeneralRe: Application_Error not called for SqlException Pin
Sandeep Mewara15-Feb-13 9:23
mvpSandeep Mewara15-Feb-13 9:23 
QuestionAuto refresh without timer Pin
ShindeAR7-Feb-13 18:02
memberShindeAR7-Feb-13 18:02 
AnswerRe: Auto refresh without timer Pin
PiyushBha7-Feb-13 19:33
memberPiyushBha7-Feb-13 19:33 
GridView Auto Refresh

In this tutorial i will let you know how to auto refresh or update GridView using AJAX Timer and UpdatePanel in asp.net. In this it is described that how a GridView is update after a specific time set in timer control.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
 
<!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></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <asp:Timer ID="Timer1" Interval="10000" runat="server" ontick="Timer1_Tick">
        </asp:Timer>
     <div>
        <asp:GridView ID="GridView1" runat="server">
        </asp:GridView>
    </div>
        <asp:Label ID="update" runat="server" Text="Label"></asp:Label>
    </ContentTemplate>
    </asp:UpdatePanel>
 
    </form>
</body>
</html>
 

 
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
public partial class _Default : System.Web.UI.Page
{
 
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
    protected void Timer1_Tick(object sender, EventArgs e)
    {
        databind();
        update.Text = " Gridview Was Last Updated at " + DateTime.Now;
    }
 
    public void databind()
    {
        string strcon = ConfigurationManager.ConnectionStrings["con"].ConnectionString;
        SqlConnection conn = new SqlConnection(strcon);
        conn.Open();
        string str = "select * from dept";
        SqlCommand cmd = new SqlCommand(str, conn);
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        DataTable dt = new DataTable();
        da.Fill(dt);
        GridView1.DataSource = dt;
        GridView1.DataBind();
 

    }
}

AnswerRe: Auto refresh without timer Pin
StyleTech Solutions Ltd9-Feb-13 3:10
groupStyleTech Solutions Ltd9-Feb-13 3:10 
AnswerRe: Auto refresh without timer Pin
Avik Ghosh2211-Feb-13 23:49
memberAvik Ghosh2211-Feb-13 23:49 
Questionconnect the e-signature pad with crystal report and get sign Pin
premaa_36@yahoo.co.in6-Feb-13 22:58
memberpremaa_36@yahoo.co.in6-Feb-13 22:58 
QuestionEmail validation against database Pin
sonal12346-Feb-13 18:18
membersonal12346-Feb-13 18:18 
AnswerRe: Email validation against database Pin
Rahul Rajat Singh6-Feb-13 21:59
mvpRahul Rajat Singh6-Feb-13 21:59 
AnswerRe: Email validation against database Pin
Ankur\m/7-Feb-13 1:50
memberAnkur\m/7-Feb-13 1:50 
QuestionValidation of viewstate MAC failed for ASP.NET 4.0 application Pin
Member 98165276-Feb-13 11:24
memberMember 98165276-Feb-13 11:24 
AnswerRe: Validation of viewstate MAC failed for ASP.NET 4.0 application Pin
Keith Barrow6-Feb-13 12:33
mentorKeith Barrow6-Feb-13 12:33 
AnswerRe: Validation of viewstate MAC failed for ASP.NET 4.0 application Pin
karthickpradhaban11-Feb-13 4:46
memberkarthickpradhaban11-Feb-13 4:46 
GeneralRe: Validation of viewstate MAC failed for ASP.NET 4.0 application Pin
smehta.er12-Feb-13 6:28
membersmehta.er12-Feb-13 6:28 
GeneralRe: Validation of viewstate MAC failed for ASP.NET 4.0 application Pin
karthickpradhaban13-Feb-13 5:24
memberkarthickpradhaban13-Feb-13 5:24 
GeneralRe: Validation of viewstate MAC failed for ASP.NET 4.0 application Pin
smehta.er13-Feb-13 5:44
membersmehta.er13-Feb-13 5:44 
GeneralRe: Validation of viewstate MAC failed for ASP.NET 4.0 application Pin
karthickpradhaban13-Feb-13 5:45
memberkarthickpradhaban13-Feb-13 5:45 
GeneralRe: Validation of viewstate MAC failed for ASP.NET 4.0 application Pin
smehta.er14-Feb-13 7:10
membersmehta.er14-Feb-13 7:10 
GeneralRe: Validation of viewstate MAC failed for ASP.NET 4.0 application Pin
karthickpradhaban7-Mar-13 5:27
memberkarthickpradhaban7-Mar-13 5:27 
QuestionDynamic width DIV next to a static width DIV Pin
jojoba20116-Feb-13 0:31
memberjojoba20116-Feb-13 0:31 
AnswerRe: Dynamic width DIV next to a static width DIV Pin
Keith Barrow6-Feb-13 12:54
mentorKeith Barrow6-Feb-13 12:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web02 | 2.8.160927.1 | Last Updated 27 Sep 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid