Solved

how can i use the code blocks inside datagrid?

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now