Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

how can i use the code blocks inside datagrid?

Posted on 2004-08-25
4
Medium Priority
?
301 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 500 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

664 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