Archive for January, 2010

Export To Excel Inside An Update Panel in

January 27, 2010 2 comments

When using export to excel inside update panel, it will popup an error like “pagerequestmanagerparsererrorexception” .

The actual problem is with Response.write, as it tries to update only certain part of the page asynchronously.

This can be solved in following ways:

1) Adding trigger :

<asp:PostBackTrigger ControlID=”btn_ExpertToExcel” />

2) Placing button outside the update panel


Refresh Content in UpdatePanel using Ajax Timer Control

January 19, 2010 1 comment

Lets say we have a requirement where we have a label control and we have assigned date time to its text, and in every 5 seconds we want to update the time, over there we need to place the label control inside the update panel and use a timer control to update its content.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "">
<html xmlns="">
<head runat="server">
    <title>Update Panel and Timer</title>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <asp:Timer runat="server" id="UpdateTimer" interval="5000"
          ontick="UpdateTimer_Tick" />
        <asp:UpdatePanel runat="server" id="TimedPanel" updatemode="Conditional">
                <asp:AsyncPostBackTrigger controlid="UpdateTimer"
                  eventname="Tick" />
                <asp:Label runat="server" id="lbldatetime" />

In the codebehind:

protected void UpdateTimer_Tick(object sender, EventArgs e)
lbldatetime.Text = DateTime.Now.ToString();

Checkbox Selection of Multiple Columns in Gridview In

January 18, 2010 Leave a comment

Many times we have to implement a scenario where we have multiple columns in gridview. Selection of checkboxes in each column in gridview. here is a complete solution for it, you can also download the code:

Toggle Div Using Jquery

January 12, 2010 Leave a comment

Show/Hide div using jquery:

     <script language="javascript" src="js/jquery.js"></script>
     <script language="javascript">
     $(document).ready(function() {
          $('#lnkbtn').click(function() {
               if ($('#divContent').is(":hidden"))
                    document.getElementById('lnkbtn').innerText = 'Hide Div';
               } else {
                    document.getElementById('lnkbtn').innerText = 'Show Div';
     <a href="javascript:void(0);" id="lnkbtn">Hide Div</a>
     <div id="divContent">

Other jquery effects can be found at :