Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Adding a System.Web.UI.WebControls.Panel to a DataGrid Cell

Reply
Thread Tools

Adding a System.Web.UI.WebControls.Panel to a DataGrid Cell

 
 
kito
Guest
Posts: n/a
 
      09-07-2006
I have the following problem. I have a list of products in a Database.
Now I would like to list them on a DataGrid, but in a special manner.
In the first cell of a row in the DataGrid I would like to put the
product-image (which is also not a problem) and in the second cell of
the DataGrid I would like to put a Panel or something, where I add
several things, like the title, description, price ... of the product
and also controls such as ImageButtons or something that do an action.

The caption of the actions of the imageButtons is not the problem. My
problem is that I'm not able to put a label into the datagrid-cell. I
could use a template column, but the problem is that all this stuff has
to be created dynamically from the database.

It must also not be a panel. It can also be some other control, where I
can add controls like buttons etc..

I hope everybody understands my problem, it is kind of difficult to
explain clearly.

Juri

 
Reply With Quote
 
 
 
 
Arsen V.
Guest
Posts: n/a
 
      09-07-2006
Juri,

You should use the TemplateColumn and use DataBinder.Eval (or just Eval() in
..NET2) to populate the proper labels, textboxes, etc.

Take a look at the following examples:

..NET 1.x
http://samples.gotdotnet.com/quickst...o9.aspx&font=3

accessible from here: http://samples.gotdotnet.com/quickstart/aspplus/
(Intro 9.aspx)

..NET 2.0
http://quickstarts.asp.net/QuickStar...aListPlain.src
accessible from here
http://quickstarts.asp.net/QuickStar...px#expressions
(C# DataBinding in a Datalist Template)

-AV

"kito" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> I have the following problem. I have a list of products in a Database.
> Now I would like to list them on a DataGrid, but in a special manner.
> In the first cell of a row in the DataGrid I would like to put the
> product-image (which is also not a problem) and in the second cell of
> the DataGrid I would like to put a Panel or something, where I add
> several things, like the title, description, price ... of the product
> and also controls such as ImageButtons or something that do an action.
>
> The caption of the actions of the imageButtons is not the problem. My
> problem is that I'm not able to put a label into the datagrid-cell. I
> could use a template column, but the problem is that all this stuff has
> to be created dynamically from the database.
>
> It must also not be a panel. It can also be some other control, where I
> can add controls like buttons etc..
>
> I hope everybody understands my problem, it is kind of difficult to
> explain clearly.
>
> Juri
>



 
Reply With Quote
 
 
 
 
kito
Guest
Posts: n/a
 
      09-10-2006
Thanks Arsen,

Your links helped me a lot. It works now, the only problem I have now
is that I cannot switch to design-view.
I have statements now such as:
<table border="1">
<tr>
<td valign="center"><img src="<%#Container.DataItem("imageURL")%>">
</td>
</tr>
</table>

I get the following error:
"Could not open in Design view. Quote values differently inside a
'<%..."value"...%>' block."

I tried to quote them differently trying the combination of
'...."value"....' and in the reverse order ".....'value'...."!
The second one doesn't even work, in the first case I get the image or
value quoted with '.
I looked up on the net, tried the solutions found there, but nothing
really works...
It's a little bit uncomfortable every time to comment out this part,
switching to design view and then when testing the app, activate the
part again...

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to set cell background based on cell value when datagrid is displayed RJ ASP .Net Datagrid Control 1 02-17-2005 09:37 PM
Adding Tooltip text to a cell in a datagrid Craig G ASP .Net 3 02-03-2005 04:37 PM
How to set and highlight text in JTable cell on selection and/or invoke cell editor directly. news.rcn.com Java 1 07-12-2004 10:22 PM
RadioButtonList In A DataGrid Cell - Can I find the selected button without editing the cell? Empire City ASP .Net Datagrid Control 3 04-30-2004 12:19 AM
multilink cell phones multilinking shotgun 2 cell phones Calvin Cisco 1 11-07-2003 02:20 PM



Advertisments