Click here to Skip to main content
12,955,959 members (87,756 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi Friends,

I have used *.ashx (generic handler file) in c# Now I want to bind grid view though .ashx (generic handler file)file. Now Eg. Normally we are binding grid view in code behind C# code like that I want do grid view binding though handler ashx file. To do this how I can achieve this.

Eg. In aspx page
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false"
AllowPaging="true" DataKeyNames="AutoId"
PageSize="5" PagerSettings-Mode="Numeric">
<asp:TemplateField HeaderText="Select">
<asp:CheckBox ID="chkSelect" runat="server" />
<asp:BoundField HeaderText="Last Name" DataField="LastName" />
<asp:TemplateField HeaderText="Is Active?">
<%# Eval("Active").ToString().Equals("True") ? "Yes" : "No" %>

Code behind C# *.cs file.
this.GridView1.DataSourceID = this.SDSForMainGrid.ID;
//Normally we binding in c# .cs code  
// similarly in *.ashx file
this.GridView1.DataSourceID = this.SDSForMainGrid.ID;

Posted 27-Aug-12 3:32am
Updated 27-Aug-12 4:02am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

The HTTPhandlers for .ashx and .aspx requests are different. These are extension based handlers and the requests are diverted to a particular handler depending upon the extension and are processes differently. You can use both of them but cannot mix them.[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,849
CHill60 3,550
Maciej Los 3,223
ppolymorphe 2,060
Jochen Arndt 1,975

Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 27 Aug 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100