Click here to Skip to main content
15,898,035 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Database? Pin
Karthick_gc16-Mar-09 21:21
Karthick_gc16-Mar-09 21:21 
GeneralRe: Database? Pin
Christian Graus16-Mar-09 21:38
protectorChristian Graus16-Mar-09 21:38 
GeneralRe: Database? Pin
Karthick_gc16-Mar-09 21:42
Karthick_gc16-Mar-09 21:42 
GeneralRe: Database? Pin
Christian Graus16-Mar-09 21:48
protectorChristian Graus16-Mar-09 21:48 
QuestionSMS Gateway Pin
rahul.net1116-Mar-09 19:41
rahul.net1116-Mar-09 19:41 
AnswerRe: SMS Gateway Pin
Christian Graus16-Mar-09 20:22
protectorChristian Graus16-Mar-09 20:22 
GeneralRe: SMS Gateway Pin
rahul.net1116-Mar-09 20:41
rahul.net1116-Mar-09 20:41 
QuestionRows deletion directly from the gridview.....without database interaction. Pin
RajpootRohan16-Mar-09 19:12
professionalRajpootRohan16-Mar-09 19:12 
Hello frnds,

I havestucked into a problem. I am unable to delete multiple rows directly from the gridview ie without any interaction with the database. Please help me out. What I have done is like this.



1        protected void BtnDelete_Click(object sender, EventArgs e)
2        {
3            try
4            {
5                dt = (DataTable)Session["Cart"];
6                CheckBox chkSelected = new CheckBox();
7                foreach (GridViewRow rowItem in GridView1.Rows)
8                {
9                    chkSelected = (CheckBox)rowItem.FindControl("chkSelection");
10                   index = rowItem.RowIndex;
11                   
12                   if (chkSelected.Checked == true)
13                   {   
14                       dt.Rows.RemoveAt(index);
15                       dt.AcceptChanges();
16                   }
17               }
18               GridView1.DataSource = dt;
19               GridView1.DataBind();
20               Session["Cart"] = dt;
21           }
22           catch(Exception ee)
23           {
24               Lblmsg.Text = ee.Message;
25           }
26   
27   
28       }



This code is working fine If I delete only one row. But suppose I have 3 rows in the gridview and I checked all the three, then it will give an error that "there is no item at position 2". That means after deleting ,the datatable is not refresing its index.

please help me.



cheers

sneha

cheers,
sneha

AnswerRe: Rows deletion directly from the gridview.....without database interaction. Pin
Christian Graus16-Mar-09 19:19
protectorChristian Graus16-Mar-09 19:19 
GeneralRe: Rows deletion directly from the gridview.....without database interaction. Pin
RajpootRohan16-Mar-09 19:40
professionalRajpootRohan16-Mar-09 19:40 
AnswerRe: Rows deletion directly from the gridview.....without database interaction. Pin
Member 282342117-Mar-09 23:57
Member 282342117-Mar-09 23:57 
QuestionInserting a blank date value in database Pin
Praneeth Babu K16-Mar-09 19:00
Praneeth Babu K16-Mar-09 19:00 
AnswerRe: Inserting a blank date value in database Pin
Christian Graus16-Mar-09 19:02
protectorChristian Graus16-Mar-09 19:02 
GeneralRe: Inserting a blank date value in database Pin
Praneeth Babu K16-Mar-09 19:13
Praneeth Babu K16-Mar-09 19:13 
GeneralRe: Inserting a blank date value in database Pin
Christian Graus16-Mar-09 19:18
protectorChristian Graus16-Mar-09 19:18 
GeneralRe: Inserting a blank date value in database Pin
Praneeth Babu K16-Mar-09 19:26
Praneeth Babu K16-Mar-09 19:26 
GeneralRe: Inserting a blank date value in database Pin
Christian Graus16-Mar-09 19:36
protectorChristian Graus16-Mar-09 19:36 
QuestionChat Pin
monika_vasvani16-Mar-09 18:36
monika_vasvani16-Mar-09 18:36 
AnswerRe: Chat Pin
Christian Graus16-Mar-09 18:45
protectorChristian Graus16-Mar-09 18:45 
AnswerRe: Chat Pin
_Maxxx_17-Mar-09 19:18
professional_Maxxx_17-Mar-09 19:18 
QuestionProblem With enternet exporer 6.0 Pin
ais0716-Mar-09 18:05
ais0716-Mar-09 18:05 
AnswerRe: Problem With enternet exporer 6.0 Pin
Christian Graus16-Mar-09 18:18
protectorChristian Graus16-Mar-09 18:18 
GeneralRe: Problem With enternet exporer 6.0 Pin
ais0716-Mar-09 18:23
ais0716-Mar-09 18:23 
GeneralRe: Problem With enternet exporer 6.0 Pin
Christian Graus16-Mar-09 18:35
protectorChristian Graus16-Mar-09 18:35 
GeneralRe: Problem With enternet exporer 6.0 Pin
ais0716-Mar-09 18:37
ais0716-Mar-09 18:37 

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.