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
Solved

how can i use the code blocks inside datagrid?

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

839 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