Solved

how can i use the code blocks inside datagrid?

Posted on 2004-08-25
4
296 Views
Last Modified: 2008-02-26
I am using DataGrid with TenplateColumns and i want to loop the template columns using code block tags<% ...%> but i get this message "Code blocks are not supported in this context". I would like to know if there is any way, any trick to loop template columns inside dataGrid. Thanks in advance..
0
Comment
Question by:Carl3003
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 28

Expert Comment

by:mmarinov
ID: 11895002
Hi,

actually you can not do that!
may if you post the reason EE members can help you in better way

Regards,
B..M
0
 

Author Comment

by:Carl3003
ID: 11895285
As far as i understand , i can not use html tags inside datagrid because of the datagrid's structure which defines a strict <table> structure and can not be changed. My problem is that i am using datagrid to edit, update, and add inline. I am using templatecolumns because onEdit event i want to show some cells in text boxes others in drop downs. In Addition to that i am adding dinamically a column with defined column name and column datatype entered by the user. If I use all these features i would want instead of doing each template column manually, i need to create columns dinamically in other words to loop rthough the entire dataset table and to create datagrid column for each datatable column. Keep in mind that the table structure will change constantly, as the user will add/ delete columns. Perhars if i code my datagrid through code behind i could do what i want ?
0
 
LVL 28

Accepted Solution

by:
mmarinov earned 125 total points
ID: 11895508
yes,
from the code behind you can create what ever control you want - columns, nested controls etc.
but you have to that carefully because of dynamically created controls are not so common: check this :http://support.microsoft.com/default.aspx?scid=kb;EN-US;317515

but in the datagrid you can use html tags and make them server controls.
the operation with this tags is pretty common by using FindControl method of the current parent control and work with the nested control

i suggest you to think not for dynamically created controls but for add all the columns that you can have and work with their Visible property

Regards,
B..M
0
 

Author Comment

by:Carl3003
ID: 11895860
Thanks, i think so too
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question