ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories  >>  Code Snippets  >>  Programming Code  >>  Dot Net Code  >>  ASP.NET Code
 
 


 

 
 ASP.NET Code interview questions  ASP.NET Code Interview Questions
 VB.NET Code interview questions  VB.NET Code Interview Questions
 C Sharp Code interview questions  C Sharp Code Interview Questions
 ADO.NET Code interview questions  ADO.NET Code Interview Questions
Question
hold checkbox values
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
 
  Re: hold checkbox values
Answer
# 1
private void CheckChkBoxStatusHold()
        {           
            ArrayList objChkBoxID = new ArrayList();   
            if (Cache[(Session["Userid"] 
+ "BankReconChkBoxID")] != null)
            {
                objChkBoxID=(ArrayList)Cache[(Session
["Userid"] + "BankReconChkBoxID")];
            }           
              for (int i = 0; i < CurPageCnt; i++)
            {
                if (intCheckSave == 1)
                {
                    if (((CheckBox)
lstBankReconcilation.Items[i].FindControl
("chkReconcile")).Checked == true)
                    {
                        objChkBoxID.Add(((Label)
lstBankReconcilation.Items[i].FindControl
("lblVoucherId")).Text);
                        DateTime dtReconDate = 
Convert.ToDateTime((((TextBox)lstBankReconcilation.Items
[i].FindControl("txtReconcileDate")).Text), new CultureInfo
("hi-IN"));
                        objChkBoxID.Add(dtReconDate.ToString
("dd-MMM-yyyy"));

                    }
                }
                else if (intCheckSave == 0)
                {
                    if (((CheckBox)
lstBankReconcilation.Items[i].FindControl
("chkReconcile")).Checked == false)
                    {
                        objChkBoxID.Add(((Label)
lstBankReconcilation.Items[i].FindControl
("lblVoucherId")).Text);
                        DateTime dtReconDate = 
Convert.ToDateTime((((TextBox)lstBankReconcilation.Items
[i].FindControl("txtReconcileDate")).Text), new CultureInfo
("hi-IN"));
                        objChkBoxID.Add(dtReconDate.ToString
("dd-MMM-yyyy"));
                       }
                }
            }          
            Cache.Remove((Session["Userid"] 
+ "BankReconChkBoxID"));
            Cache[(Session["Userid"] 
+ "BankReconChkBoxID")] = objChkBoxID;
        }
 
Is This Answer Correct ?    0 Yes 0 No
Sona
 
  Re: hold checkbox values
Answer
# 2
this one fr retrieving

private void CheckChkBoxStatusRetrieve()
        { 
            ArrayList objChkBoxRetrieve=new ArrayList();
            if (Cache[(Session["Userid"] 
+ "BankReconChkBoxID")] != null)
            { 
                objChkBoxRetrieve=(ArrayList)Cache[(Session
["Userid"] + "BankReconChkBoxID")];
                for (int j = 0; j < 
objChkBoxRetrieve.Count; j++)
                {
                    for (int i = 0; i < CurPageCnt; i++)
                    {
                        if (objChkBoxRetrieve[j].ToString() 
== ((Label)lstBankReconcilation.Items[i].FindControl
("lblVoucherId")).Text)//lblVoucherNo
                        {
                            ((CheckBox)
lstBankReconcilation.Items[i].FindControl
("chkReconcile")).Checked = true;
                            ((TextBox)
lstBankReconcilation.Items[i].FindControl
("txtReconcileDate")).Text =  DateTime.Now.ToString
("dd/MM/yyyy");
                        }
                    }
                }
            }
        }
 
Is This Answer Correct ?    1 Yes 0 No
Sona
 
 
 
  Re: hold checkbox values
Answer
# 3
private List<int> IDs
    {
        get
        {
            if (this.ViewState["IDs"] == null)
            {
                this.ViewState["IDs"] = new List<int>();
            }
            return (List<int>)this.ViewState["IDs"];
        }
    }


    protected void AddRowstoIDList()
    {
        int checkAction = 0;

        foreach (ListViewDataItem lvi in lvUsersinGroup.Items)
        {
            CheckBox chkSelect =
(CheckBox)lvi.FindControl("chkSelect");
            if ((((chkSelect) != null)))
            {
                int ID =
Convert.ToInt32(lvUsersinGroup.DataKeys[lvi.DisplayIndex].Value);


                if ((chkSelect.Checked &&
!this.IDs.Contains(ID)))
                {
                    this.IDs.Add(ID);
                    checkAction += 1;
                }
                else if ((!chkSelect.Checked &&
this.IDs.Contains(ID)))
                {
                    this.IDs.Remove(ID);
                }
            }
        }


    }
 
Is This Answer Correct ?    0 Yes 1 No
Kris
 
  Re: hold checkbox values
Answer
# 4
1] 
http://blog.evonet.com.au/post/2008/08/Maintaining-Checkbox-State-in-a-Listview.aspx

2] 
http://demo.evonet.com.au/MaintainingListviewCheckboxState.aspx

3] 
http://www.codeproject.com/KB/webforms/States_of_CheckBoxes.aspx

4]  http://forums.asp.net/t/1282544.aspx

5] 
http://www.ilearnttoday.com/index.php/c-aspnet-gridview-how-to-keep-modified-data-of-template-fields-when-paging-is-enabled/comment-page-1
 
Is This Answer Correct ?    1 Yes 0 No
Sona
 

 
 
 
Other ASP.NET Code Interview Questions
 
  Question Asked @ Answers
 
how to upload a photo? i need to use it in a matrimonial applicaton...  1
how can we close a web page in asp.net without using jscript?  1
How to add checkbox to datagrid?  4
How to Create Scrollable Micro Windows?  2
working with fileUpload ?  1
Give coding for Implementing a Fixed GridView Header in ASP.NET?  1
How to Export Data to Excel? Eastcom-Systems3
How to integrate the regional language in asp.net and c# like Telugu, Hindi etc,. send a sample program NIIT2
Code for Getting Information About A File?  1
how to convert Dataset to Object Array or list in c# .net  3
What do you create for easier access of data? NIIT2
How to send e-mail from an ASP.NET application? TCS10
How we implement the paypal in my website and how we make a payment through Credit Card.  2
how to upload an excel in c# ASP.Net?  2
what is the value that reside in a hidden field when no value is assigned to it?how it can be used in a if statement??  1
HOw to Build a Nested GridView Control with ASP.NET?  1
hold checkbox values  4
Code for a Simple Way to Write XML in .NET (XmlTextWriter)  1
How to get the row index on checking a Checkbox in a ListView  1
Data Reader Vs DataSet TCS1
 
For more ASP.NET Code Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com