Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 8th, 2006, 11:58 AM
Authorized User
 
Join Date: Dec 2005
Location: bangalore, karnataka, India.
Posts: 77
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to g_vamsi_krish
Default Toggle CheckBox

Hai,
   I want to have a toggle check box in my datagrid.
I had a datagrid i want to hava a check box in the datagrid header or templete column. If i check that check box, it should check all the check box in that column. And this should happen in the client side. I saw the same functionality in yahoo or gmail.

                                     thank in advance.




vamsi
__________________
vamsi Krishna G
mobile: 91 + 9986023966.
124 Puttappa layout new Tippasandhra,
bangalore.
Inida
  #2 (permalink)  
Old February 13th, 2006, 03:00 AM
Authorized User
 
Join Date: Dec 2005
Location: bangalore, karnataka, India.
Posts: 77
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to g_vamsi_krish
Default

This is the sample code for the Toggle check boxes.

we need to use java script function for selecting and un selecting the check boxes.


// code for selecting and deselecting checkboxes

    function select_deselectAll (chkVal, idVal)
    {
        var frm = document.forms[0];
        // Loop through all elements
        for (i=0; i<frm.length; i++)
        {
            // Look for our Header Template's Checkbox
            if (idVal.indexOf ('CheckAll') != -1)
            {
                // Check if main checkbox is checked, then select or deselect datagrid checkboxes
                if(chkVal == true)
                {
                    frm.elements[i].checked = true;
                }
                else
                {
                    frm.elements[i].checked = false;
                }
                // Work here with the Item Template's multiple checkboxes
            }
            else if (idVal.indexOf ('DeleteThis') != -1)
            {
                // Check if any of the checkboxes are not checked, and then uncheck top select all checkbox
                if(frm.elements[i].checked == false)
                {
                    frm.elements[1].checked = false; //Uncheck main select all checkbox
                }
            }
         }
    }
================================================== ==========================================



This is aspcode.

<form runat="server" ID="Form1">
    <h3>Selecting, Confirming &amp; Deleting Multiple Checkbox Items In A DataGrid
        (i.e. HotMail &amp; Yahoo)</h3>
    <br>
    <ASP:DataGrid id="MyDataGrid" runat="server" Width="700" BackColor="white" BorderColor="black"
        CellPadding="3" CellSpacing="0" Font-Size="9pt" AutoGenerateColumns="False" HeaderStyle-BackColor="darkred"
        HeaderStyle-ForeColor="white">
        <Columns>
<asp:TemplateColumn>
                <HeaderTemplate>
                    <asp:CheckBox ID="CheckAll" OnClick="javascript: return select_deselectAll (this.checked, this.id);"
                        runat="server" />
                    a
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="DeleteThis" OnClick="javascript: return select_deselectAll (this.checked, this.id);"
                        runat="server" />
                </ItemTemplate>
            </asp:TemplateColumn>
// ... Rest of our Custom Template & Bound Columns
</Columns>
</form>


vamsi
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
hi xml toggle effect gauravkg XSLT 1 September 8th, 2006 09:04 AM
Toggle/Drilldown help...please!!! s15199d Reporting Services 4 March 24th, 2006 04:11 PM
Toggle Buttons ctekk2005 Access 3 June 15th, 2005 03:36 AM
Toggle Key calvados VB.NET 2002/2003 Basics 2 December 17th, 2004 10:55 AM
Language toggle dsunmedia PHP How-To 2 August 2nd, 2004 11:00 AM



All times are GMT -4. The time now is 06:08 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.