Solved

how can i use the code blocks inside datagrid?

Posted on 2004-08-25
4
298 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
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 …
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

626 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