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

Discussion in 'ASP .Net' started by kito, Sep 7, 2006.

  1. kito

    kito Guest

    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
    kito, Sep 7, 2006
    #1
    1. Advertising

  2. kito

    Arsen V. Guest

    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/quicks...s/intro/Intro9.src&file=CS\Intro9.aspx&font=3

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

    ..NET 2.0
    http://quickstarts.asp.net/QuickSta...~/aspnet/samples/data/PhotosDataListPlain.src
    accessible from here
    http://quickstarts.asp.net/QuickStartv20/aspnet/doc/data/templates.aspx#expressions
    (C# DataBinding in a Datalist Template)

    -AV

    "kito" <> wrote in message
    news:...
    > 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
    >
    Arsen V., Sep 7, 2006
    #2
    1. Advertising

  3. kito

    kito Guest

    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...
    kito, Sep 10, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris
    Replies:
    2
    Views:
    1,758
    Chris Barrow
    Jul 22, 2003
  2. Matt
    Replies:
    2
    Views:
    836
    Matt Getting
    Jul 24, 2003
  3. Andy B
    Replies:
    2
    Views:
    3,156
    Andy B
    Apr 23, 2008
  4. Ray
    Replies:
    0
    Views:
    174
  5. David Smith via .NET 247

    Derive from System.Web.UI.WebControls.Panel

    David Smith via .NET 247, May 5, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    233
    Chad Z. Hower aka Kudzu
    May 6, 2004
Loading...

Share This Page