Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
Hi Friends,
 
I have used *.ashx (generic handler file) in c# asp.net. 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">
<columns>
<asp:TemplateField HeaderText="Select">
<itemtemplate>
<asp:CheckBox ID="chkSelect" runat="server" />
</itemtemplate>
 
<asp:BoundField HeaderText="Last Name" DataField="LastName" />
<asp:TemplateField HeaderText="Is Active?">
<itemtemplate>
<%# Eval("Active").ToString().Equals("True") ? "Yes" : "No" %>
</itemtemplate>
</columns>
Code behind C# *.cs file.
this.GridView1.DataSourceID = this.SDSForMainGrid.ID;
this.GridView1.DataBind();
 
//Normally we binding in c# .cs code  
// similarly in *.ashx file

this.GridView1.DataSourceID = this.SDSForMainGrid.ID;
this.GridView1.DataBind();
 
Thanks
PBN
Posted 27-Aug-12 3:32am
PKeloor895
Edited 27-Aug-12 4:02am
v2

1 solution

Rate this: bad
good
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.
 
http://stackoverflow.com/questions/391130/what-is-a-httphandler-in-asp-net[^]
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 881
1 OriginalGriff 270
2 Volynsky Alex 205
3 CPallini 180
4 Richard Deeming 175
0 OriginalGriff 5,640
1 Sergey Alexandrovich Kryukov 4,693
2 CPallini 4,540
3 George Jonsson 3,132
4 Gihan Liyanage 2,445


Advertise | Privacy | Mobile
Web01 | 2.8.140916.1 | Last Updated 27 Aug 2012
Copyright © CodeProject, 1999-2014
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