Click here to Skip to main content
15,313,293 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
    {
          ImageButton edit = (ImageButton)PreviousPage.FindControl("lnkEdit");
          ImageButton delete = (ImageButton)PreviousPage.FindControl("lnkDelete");
        CheckBox chkTest = (CheckBox)sender;
        GridViewRow grdRow = (GridViewRow)chkTest.NamingContainer;
        if (chkTest.Checked)
        {
            edit.Visible = true;
            delete.Visible = true;
        }
        else
        {
            edit.Visible = false;
            delete.Visible = false;
        }

    }

hi this is my code when i am not checking the chekboxes the also my image buttons are visible
Posted
Updated 3-Mar-14 20:19pm
v2
Comments
Charan_Kumar 4-Mar-14 2:36am
   
did you mean prevoiuspage.findcontrol?
Member 10578683 4-Mar-14 4:34am
   
yes
Charan_Kumar 4-Mar-14 5:07am
   
had you define what is the previous page in aspx?
Jhone2011 4-Mar-14 4:11am
   
first thing are you trying to access previous page control, secand are you sure you are checking a right check box because ur event name and control name is missmatch ie "CheckBox1" v/s chktest. pls clear with information to identitify issue.
Member 10578683 4-Mar-14 4:47am
   
ya i m checking right checkbox but it is showing null reference error

If this is all the processing that happens on the check changed, you could do it on the client side. By setting display to none.
   
Comments
Member 10578683 4-Mar-14 2:31am
   
but how
Member 10578683 4-Mar-14 2:32am
   
that edit or delete button present in a grid view
Hi first u can change linkedit and linkdelete property visible to flase in design time or in page load event u can set property from both link button visible as false.

Regards
Aravind
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900