GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Microsoft  >  DataGrid
Go To First  |  Previous Question  |  Next Question 
 DataGrid  |  Question 8 of 14    Print  
Hi, I was asked this in an Interview I want to add buttons,images,etc to the footer of a datagrid at runtime. how would i achieve this?

  
Total Answers and Comments: 4 Last Update: June 01, 2009     Asked by: Yatin 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
October 18, 2006 05:30:00   #1  
M.Nagababu        

RE: Hi, I was asked this in an Interview I want to add...

Hi Yatin

to added controls to the footer of the datagrid we use <footer Template> </footer template> command in <template columns> </template colums>. For example we a button control in a footer of datagrid like this:

<datagrid><columns><template columns><footer template><asp:button id btn1 label button runat server></asp:button></footer template></template columns></columns></datagrid>

in the same way we add controls to header also. by using <header template></header template>


 
Is this answer useful? Yes | No
July 15, 2008 01:57:07   #2  
anjani Member Since: November 2005   Contribution: 2    

RE: Hi, I was asked this in an Interview I want to add buttons,images,etc to the footer of a datagrid at runtime. how would i achieve this?
hi

Add buttons images etc to the footer in the data grid u use the template field conept in the html file

<Columns>

<asp:TemplateField>

<HeaderTemplate>
HTML TEXT SERVER
</HeaderTemplate>

<ItemTemplate>
HTML TEXT SERVER
</ItemTemplate>


<FooterTemplate>
<asp:Button ID "Btn_Add" runat "server" CommandName "AddUser" Text "Add"/>
</FooterTemplate>

</asp:TemplateField>

</Columns>

from that coding a button will be add in the footer of the gridview in the similar way we can add other controls also.

 
Is this answer useful? Yes | No
March 25, 2009 02:50:49   #3  
nt57323 Member Since: March 2009   Contribution: 9    

RE: Hi, I was asked this in an Interview I want to add buttons,images,etc to the footer of a datagrid at runtime. how would i achieve this?
You can add the controls in the footer similar to the way how you add a control for a column.
If you want to add the control in the footer you should take template field. In the template field you will be having footer template. Just drag and drop the control which ever you like.

 
Is this answer useful? Yes | No
June 01, 2009 09:34:49   #4  
albu77 Member Since: September 2007   Contribution: 9    

RE: Hi, I was asked this in an Interview I want to add buttons,images,etc to the footer of a datagrid at runtime. how would i achieve this?
As they ask you to do it at run time you need to add the controls to the control collection of the cell of the footer row of the gridView.
Button myBtn new Button();

gvTest.FooterRow.Cells[1].Controls.Add(myBtn);

Play caution where the dynamic addition is done if you want it to persist.


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape