Posts Tagged ‘’

Using Jquery, Json with

The following article explains how we can use Jquery with

Part 1:

Part 2 :


Using Ajax Update Progress

March 22, 2010 1 comment

Here in this article, we will learn how to use updateprogress control that comes ajax toolkit.

<asp:ScriptManager ID=”scriptManager” runat=”server” />

<asp:UpdatePanel ID=”UdpLogin” runat=”server”>


Content comes here…


<asp:Panel ID=”UpdateProgress” runat=”server” CssClass=”ProgressContent” Width=”100%”
<asp:UpdateProgress ID=”UpdateProg” runat=”server” DisplayAfter=”1″ AssociatedUpdatePanelID=”UdpLogin”>
<asp:Panel ID=”UpdatePro” runat=”server” CssClass=”Trans” Width=”100%” Height=”100%”>
<table width=”100%” height=”100%”>
<td align=”center” valign=”middle” width=”100%” height=”100%”>
<asp:Image ID=”imgProg” runat=”server” ImageUrl=”~/img/loading.gif” AlternateText=”Updating ……”
ImageAlign=”Middle” />

Css Styles to include here are as follows:

/* StyleSheet for Update Progress */
font-family: verdana;
font-size: 11px;
color: #000000;
font-weight: normal;
text-decoration: none;

background-color: White;
filter: alpha(opacity=70);
opacity: 0.7;
position: absolute;
left: 0px;
top: 0px;
font-family: verdana;
font-size: x-small;
color: Green;
font-weight: bold;
text-decoration: none;
height: auto;

Please visit my previous article for downloading loading images:

Read/Write Section from/into Web.config in

Many times, we need to read sections from web.config or write into web.config.

I have a requirement where i need to write an section in web.config that points to another config file.

Below is the code where “abc” is the section

Configuration objConfig = WebConfigurationManager.OpenWebConfiguration(“~”);
ConfigurationSection section = objConfig.Sections[“abc”];
string str = “abcdef”;

The above code will read “abc” section and write the content in str.

For Reading Appsettings from web.config, below is the code

Configuration config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath); AppSettingsSection appSettings = (AppSettingsSection) config.GetSection(appSettings);

string[] appKeys = appSettings.Settings.AllKeys;

for (int i = 0; i < appSettings.Settings.Count; i++)





Using Dataview RowFilter (Syntax) in C#

February 8, 2010 1 comment

Lets say we have a datatable, we want to select rows that meet certain criteria, then we can use Dataview.Rowfilter.

For example we have a datatable having empid column, we want the row whose empid is 8.

dataView.RowFilter = "empid = 8";

Other examples are
dataView.RowFilter = "EmpName = 'Pankaj'" ;
dataView.RowFilter = "Date = #12/08/2000#" ;

dataView.RowFilter = "Date>=" + "#" + startdate + "#" +
"And Date <=" + "#" + enddate + "#";
You can find other examples at:

Validator Enable/Disable in using Javascript

February 3, 2010 Leave a comment

You can enable/disable validators using javascript as follows:

ValidatorEnable(document.getElementById(‘<%= rfv.ClientID %>’), false);

First argument is id of validator, second argument is to enable pass “true”, else pass “false”.

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();