?
Solved

Dynamic datagrid

Posted on 2004-11-06
7
Medium Priority
?
417 Views
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 ASP.net 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>
        <TBODY>
        <TR id=trHeader pagesize="">
          <TD></TD>
          <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
0
Comment
Question by:jinhong23
6 Comments
 
LVL 21

Expert Comment

by:surajguptha
ID: 12516697
IF you want to tick/untick a checkbox you can use the following code

document.all.theBox.checked=true;
document.all.theBox.checked=false;
0
 
LVL 21

Expert Comment

by:surajguptha
ID: 12516698
I am very sorry. I posted the above comment by mistake.
Please excuse me
0
 
LVL 28

Expert Comment

by:mmarinov
ID: 12516759
Hi jinhong23,

you can use the repeater control - it is design exactly for this purpose - to render what the developer whants
<asp:repeater>
    <HeaderTemplate>
    ad your column definitions
</HeaderTemplate>
<itemtemplate>
render your data
</itemtemplate>
<footertemplate>
close the table tag
</footertemplate>
</asp:repeater>

Regards!
B..M
mmarinov
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 26

Expert Comment

by:Rejojohny
ID: 12517142
>>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" ....
...
</asp:datagrid>
0
 

Author Comment

by:jinhong23
ID: 12520425
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.
0
 
LVL 26

Accepted Solution

by:
Rejojohny earned 500 total points
ID: 12521010
try adding them as attributes to the itemstyle tags ... it might work ..
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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.…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Integration Management Part 2
Suggested Courses
Course of the Month16 days, 11 hours left to enroll

864 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