Dynamic datagrid

Posted on 2004-11-06
Last Modified: 2008-02-01
I currently designing a datagrid template. I wonder how to set/add some bahaviour, class to table column in datagrid webcontrol.
Below is the HTML i expected to get when rendering to HTML.

 <TABLE class="gridBar gridSort" id=gridBar cellSpacing=0 cellPadding=0>
        <COLGROUP id=gridBarCols>
        <COL width=2>
        <COL width=125><COL id=colAutoExpander>
        <COL width=2>
        <COL width=83>
        <COL width=2>
        <COL width=83>
        <COL width=2>
        <COL width=108>
        <COL width=2>
        <COL width=14></COLGROUP>
        <TR id=trHeader pagesize="">
          <TD class=sort title="Sort by Activity Subject"  ondragover=event.returnValue=false; field="subject" isExpanderParent="1"><NOBR>Activity Subject  <IMG class=sort  src="grid_container_files/bar_up.gif" width="13" height="5"></NOBR></TD></TR></TBODY></TABLE>

Hope someone can give me some guidelines on this. Thank You
Question by:jinhong23
    LVL 21

    Expert Comment

    IF you want to tick/untick a checkbox you can use the following code

    LVL 21

    Expert Comment

    I am very sorry. I posted the above comment by mistake.
    Please excuse me
    LVL 28

    Expert Comment

    Hi jinhong23,

    you can use the repeater control - it is design exactly for this purpose - to render what the developer whants
        ad your column definitions
    render your data
    close the table tag

    LVL 26

    Expert Comment

    >>I wonder how to set/add some bahaviour, class to table column in datagrid webcontrol
    do u mean style class  ... if s, then
    for header u can use the headerstyle tag
    <HeaderStyle CssClass="GridHeader">
    for the footer .. if u have totals u can use the
    <FooterStyle CssClass="GridFooter">

    and any class grid can have its own class .. i.e.
    <asp:datagrid  CssClass="gridBar" ....

    Author Comment

    Refer back to HTML code that i provided

    <TD class=sort title="Sort by Activity Subject"  ondragover=event.returnValue=false; field="subject" isExpanderParent="1">

    As you can translate from above HTML, when mouse rollover to the grid column, it is able to see a tag "Sort by Activity Subject", when ondragover or other bahaviour, it able to perform as what it is & etc

    What i want to know is how can i pass all these attibutes and values to datagrid's item column. i know that Cssclas can be assigned using  ItemStyle-CssClass , like the code below
    <asp:BoundColumn DataField="Column1" ItemStyle-CssClass ="sort"></asp:BoundColumn>.

    How about other attribute like "title", behaviour like onclick, ondragover & etc.
    LVL 26

    Accepted Solution

    try adding them as attributes to the itemstyle tags ... it might work ..

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    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…
    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…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    759 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

    11 Experts available now in Live!

    Get 1:1 Help Now