Click here to Skip to main content
15,890,412 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: how to stop refreshing a page when a button clicked at client Pin
prasadbuddhika25-Mar-09 0:11
prasadbuddhika25-Mar-09 0:11 
AnswerRe: how to stop refreshing a page when a button clicked at client Pin
Abhijit Jana25-Mar-09 0:18
professionalAbhijit Jana25-Mar-09 0:18 
QuestionStoring a text file on the client side Pin
dayakar_dn24-Mar-09 23:22
dayakar_dn24-Mar-09 23:22 
AnswerRe: Storing a text file on the client side Pin
mr_muskurahat25-Mar-09 2:19
mr_muskurahat25-Mar-09 2:19 
AnswerRe: Storing a text file on the client side Pin
Ashfield25-Mar-09 2:31
Ashfield25-Mar-09 2:31 
Questioncrystal engine error when click on lastpage Pin
bikash pattanayak24-Mar-09 23:08
bikash pattanayak24-Mar-09 23:08 
QuestionCrystal Report [modified] Pin
JAYRAJ GIRI24-Mar-09 23:08
JAYRAJ GIRI24-Mar-09 23:08 
Questioncheckbox problem.... Pin
RajpootRohan24-Mar-09 22:04
professionalRajpootRohan24-Mar-09 22:04 
Hi to all,

I have stucked in a problem. I dont know where I am lacking.

Actually I have a gridview in which there is a column of a checkbox. Now I want to delete the rows for which the checkbox is selected. I have done like this.

protected void Page_Load(object sender, EventArgs e)
{
    dt = (DataTable)Session["data"];
    GridView1.DataSource = dt;
    GridView1.DataBind();
}

protected void BtnDelete_Click(object sender, EventArgs e)
{
    try
    {
        dt = (DataTable)Session["Cart"];
        dt.PrimaryKey = new DataColumn[] { dt.Columns["REF"] };

        CheckBox chkSelected = new CheckBox();
        foreach (GridViewRow rowItem in GridView1.Rows)
        {
            chkSelected = (CheckBox)rowItem.FindControl("chkSelection");
            //index = rowItem.RowIndex;

            if (chkSelected.Checked == true)
            {
                DataKey dk = GridView1.SelectedDataKey;
                string sCellProductID = rowItem.Cells[0].Text;
                DataRow dtRemoveMe = dt.Rows.Find(sCellProductID);
                if (dtRemoveMe != null)
                {
                    dt.Rows.Remove(dtRemoveMe);
                    dt.AcceptChanges();
                }
            }
        }
        Lblmsg.Text = "The items are successfully deleted!!";
        GridView1.DataSource = dt;
        GridView1.DataBind();
        Session["Cart"] = dt;
    }
    catch(Exception ee)
    {
        Lblmsg.Text = ee.Message;
    }

}




I dont know where I am lacking...Please help me out.



cheers

sneha[Smile | :) ]

cheers,
sneha

AnswerRe: checkbox problem.... Pin
Abhijit Jana24-Mar-09 22:09
professionalAbhijit Jana24-Mar-09 22:09 
QuestionWeb Response Pin
blakshmi24-Mar-09 21:54
blakshmi24-Mar-09 21:54 
AnswerRe: Web Response Pin
Abhijit Jana24-Mar-09 22:12
professionalAbhijit Jana24-Mar-09 22:12 
QuestionCrisis with a dynamically created drop down list Pin
scar_face24-Mar-09 21:48
scar_face24-Mar-09 21:48 
Questionincrease the size of content page. Pin
maheshsahini24-Mar-09 21:30
maheshsahini24-Mar-09 21:30 
AnswerRe: increase the size of content page. Pin
Abhijit Jana24-Mar-09 22:05
professionalAbhijit Jana24-Mar-09 22:05 
Questionconnection code problem.. Pin
yorockk24-Mar-09 21:29
yorockk24-Mar-09 21:29 
AnswerRe: connection code problem.. Pin
Abhijit Jana24-Mar-09 21:58
professionalAbhijit Jana24-Mar-09 21:58 
GeneralRe: connection code problem.. Pin
yorockk24-Mar-09 22:51
yorockk24-Mar-09 22:51 
GeneralRe: connection code problem.. Pin
Abhijit Jana24-Mar-09 23:12
professionalAbhijit Jana24-Mar-09 23:12 
GeneralRe: connection code problem.. Pin
yorockk25-Mar-09 3:45
yorockk25-Mar-09 3:45 
AnswerRe: connection code problem.. Pin
Greg Chelstowski25-Mar-09 1:28
Greg Chelstowski25-Mar-09 1:28 
GeneralRe: connection code problem.. Pin
yorockk25-Mar-09 3:43
yorockk25-Mar-09 3:43 
GeneralRe: connection code problem.. Pin
yorockk25-Mar-09 3:48
yorockk25-Mar-09 3:48 
Questionpaging in datalist Pin
maheshsahini24-Mar-09 21:27
maheshsahini24-Mar-09 21:27 
AnswerRe: paging in datalist Pin
Abhijit Jana24-Mar-09 22:02
professionalAbhijit Jana24-Mar-09 22:02 
AnswerRe: paging in datalist Pin
vinodkrebc24-Mar-09 23:42
vinodkrebc24-Mar-09 23:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.