What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 37146 |  Welcome, Guest!   Register  Login
 Home > Forums > DotNetFunda.Com > how to sort column in template field in gridview(ASP.NET) ...
Cvbharathi89

how to sort column in template field in gridview(ASP.NET)

Replies: 2 | Posted by: Cvbharathi89 on 4/22/2012 | Category: DotNetFunda.Com Forums | Views: 1068 | Status: [Member] | Points: 10  Download source file 


Sir,
i searched many site to sort a value in template field in grid view but no use, i hope your team will help me , please assist me to sort the column in grid view, here i write my source and code behind code please Reply me with how to include sorting code with this code,Thanks in Advance.

bharathi.c.v


Reply | Reply with attachment | Alert Moderator

 Responses below this adGet hundreds of .NET Tips and Tricks videos

 Replies

Gsm_Gsv
Gsm_Gsv  
Posted on: 4/22/2012 9:07:24 AM
Level: Starter | Status: [Member] | Points: 25

Where is the datasourceID for gridview?

compare with the below code.. If you face any problem, let me know

 <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 

AllowSorting="True" BorderStyle="None" DataKeyNames="Title"
DataSourceID="ObjectDataSource1" EmptyDataText="No Data Found" Font-Bold="True"
OnRowCommand="GridView1_RowCommand" PageSize="5" Visible="False" Width="62%">
<PagerSettings PageButtonCount="5" Position="Top" />
<RowStyle BackColor="#66FFFF" HorizontalAlign="Center" VerticalAlign="Middle" />
<EmptyDataRowStyle ForeColor="Red" />
<Columns>
<asp:BoundField />
<asp:TemplateField>
<HeaderTemplate>
Delete
</HeaderTemplate>
<ItemTemplate>
<asp:Button ID="BtnDelete" runat="server" CommandArgument='<%#Eval("Title")%>'
CommandName="Del"
OnClientClick="return confirm('Are you sure you want to delete this record?');"
Text="Delete" />
<asp:Button ID="BtnEdit" runat="server" CommandArgument='<%#Eval("Title") %>'
CommandName="edit" Text="Edit" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<PagerStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<HeaderStyle BackColor="#FF9966" />
<EditRowStyle BackColor="White" HorizontalAlign="Center"
VerticalAlign="Middle" />
<AlternatingRowStyle BackColor="White" HorizontalAlign="Center"
VerticalAlign="Middle" />
</asp:GridView>


---------------------------------------
Live the life you've dreamed

Regards
MADHU

Cvbharathi89, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Cvbharathi89
Cvbharathi89  
Posted on: 4/22/2012 9:44:55 PM
Level: Starter | Status: [Member] | Points: 25

Sir,
Thanks for your reply, i have questioned with my code please download from DATA SOURCE FILE which is below my Question line , please reply with sorting code in both Source code and Code Behind Code.


bharathi.c.v

Cvbharathi89, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Reply - Please login to reply


Click here to login & reply

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/23/2013 4:27:33 AM