Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 17th, 2006, 02:57 AM
Registered User
 
Join Date: Oct 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to status of Checkbox of itemcolumn in webpart

HI,

I Have DataGrid webpart with Itemtemplate Column with Checkbox as the item.after databinding to the datagrid, i am checking the status of the checkbox.but i am getting always false value from the checkbox.
please help me regarding this

I am Useing the following code......
//-----------to check the status.........
foreach(DataGridItem item in UserDataGrid.Items)
            {
                // HtmlInputCheckBox chk;
                //chk=(HtmlInputCheckBox)item.Cells[0].FindControl("chkNaveen") ;
                CheckBox selected=(CheckBox)item.FindControl("chkNaveen");
                if(!selected.Checked)
                {
                    System.Web.HttpContext.Current.Response.Write("Nav een");
                    //deleted = _oLNService.DeleteUserMailData(UserName,DkValue);
                }

            }

//----------adding the template column dynamically...........
tcol.HeaderText="Delete";

            tcol.ItemStyle.HorizontalAlign=HorizontalAlign.Cen ter;
            tcol.ItemTemplate = mycol;
            //tcol.HeaderTemplate=myheader;
            UserDataGrid.Columns.Add(tcol);

//-----------template column Class.........

public class ColumnTemplate : ITemplate
        {
            private ListItemType itemType;
            string strText;
            string strCheckboxName;
            bool Visibility = true;
            bool blChecked= false;
            // public ColumnTemplate(string CheckboxName,string Text,bool AutoCheck)
            // {
            // this.strText =Text;
            // this.strCheckboxName=CheckboxName;
            // this.blChecked=AutoCheck;
            // }

            public void InstantiateIn(Control container)
            {
                CheckBox mycheckbox = new CheckBox();
                //HtmlInputCheckBox mycheckbox = new HtmlInputCheckBox();
                mycheckbox.DataBinding+=new EventHandler(mycheckbox_DataBinding);
                container.Controls.Add(mycheckbox);
                container.EnableViewState=true;


            }
}






Similar Threads
Thread Thread Starter Forum Replies Last Post
checkbox checked by default by html:checkbox sachin.tathod Struts 3 December 4th, 2006 03:41 PM
WebPart rrsparihar ASP.NET 2.0 Professional 0 October 4th, 2006 12:20 AM
Problem with WebPart rrsparihar Visual Studio 2005 0 October 3rd, 2006 09:41 AM
webpart sawjansee BOOK: Professional Web Parts and Custom Controls ASP.NET ISBN: 0-7645-7860-X 0 June 18th, 2006 12:12 AM
Updating user status with checkbox arnabghosh Pro PHP 1 February 12th, 2006 06:02 PM





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