Click here to Skip to main content
15,906,106 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionThe operation has timed out for simple Web request. Pin
Vilas Dilip Patil11-Sep-09 4:06
Vilas Dilip Patil11-Sep-09 4:06 
AnswerRe: The operation has timed out for simple Web request. Pin
sashidhar11-Sep-09 5:51
sashidhar11-Sep-09 5:51 
AnswerRe: The operation has timed out for simple Web request. Pin
Abhishek Sur11-Sep-09 8:15
professionalAbhishek Sur11-Sep-09 8:15 
QuestionRemoting in ASP.net 2.0 Pin
slimtugo11-Sep-09 3:24
slimtugo11-Sep-09 3:24 
AnswerRe: Remoting in ASP.net 2.0 Pin
Manas Bhardwaj11-Sep-09 3:33
professionalManas Bhardwaj11-Sep-09 3:33 
QuestionPersist a controls view state in masterpage Pin
tonymathewt11-Sep-09 3:11
professionaltonymathewt11-Sep-09 3:11 
AnswerRe: Persist a controls view state in masterpage Pin
r a m e s h11-Sep-09 3:22
r a m e s h11-Sep-09 3:22 
QuestionNeed to delete row in gridview but must not affect that row in the database. Pin
renoma11-Sep-09 2:10
renoma11-Sep-09 2:10 
Hi there!

I am having difficulty in deleting a row from a gridview. I would like to delete a row of data in a gridview using checkbox but at the same time would not delete that data from the database. I have tried using deleteRow method but am still struggling. Is there a work-around solution for this?

BtnDelete Method

Protected Sub btnDelete_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDelete.Click

If Not IsPostBack Then

Dim Row2 As GridViewRow
Dim rowCell As String = ""
Dim count As Integer = 0
Dim test As Integer = 0
Try
For Each row As GridViewRow In GridView1.Rows

Dim checkBxText As String = CType(row.FindControl("chkDelete"), CheckBox).Text

Row2 = GridView1.Rows(count)

rowCell = Row2.Cells(2).Text

Dim cb As CheckBox = DirectCast(row.FindControl("chkDelete"), CheckBox)

If cb.Checked Then
Try
'GridView1.Row(row.RowIndex).Delete()
MsgBox(row.RowIndex)
GridView1.DeleteRow(row.RowIndex)
Catch ex As Exception
'MsgBox(count)
GridView1.DataBind()
End Try

Else

End If
count += 1
'DataBind()

Next

Catch ex As Exception
MsgBox(ex.Message)

End Try

End If

'BindData(idSelection)
End Sub

Private Sub ToggleCheckState(ByVal checkState As Boolean)
For Each row As GridViewRow In GridView1.Rows
Dim cb As CheckBox = row.FindControl("chkDelete")
If cb IsNot Nothing Then
cb.Checked = checkState
End If
Next
End Sub
AnswerRe: Need to delete row in gridview but must not affect that row in the database. Pin
Meetu Choudhary11-Sep-09 2:17
Meetu Choudhary11-Sep-09 2:17 
AnswerRe: Need to delete row in gridview but must not affect that row in the database. Pin
Md. Marufuzzaman11-Sep-09 4:17
professionalMd. Marufuzzaman11-Sep-09 4:17 
QuestionRemove items from generic list Pin
yesu prakash11-Sep-09 1:52
yesu prakash11-Sep-09 1:52 
AnswerRe: Remove items from generic list Pin
sashidhar11-Sep-09 1:57
sashidhar11-Sep-09 1:57 
AnswerRe: Remove items from generic list Pin
N a v a n e e t h11-Sep-09 2:43
N a v a n e e t h11-Sep-09 2:43 
Questionerror Pin
ankitjain111011-Sep-09 1:26
ankitjain111011-Sep-09 1:26 
AnswerRe: error Pin
Meetu Choudhary11-Sep-09 1:32
Meetu Choudhary11-Sep-09 1:32 
GeneralRe: error Pin
ankitjain111011-Sep-09 1:34
ankitjain111011-Sep-09 1:34 
AnswerRe: error Pin
Meetu Choudhary11-Sep-09 1:33
Meetu Choudhary11-Sep-09 1:33 
GeneralRe: error Pin
ankitjain111011-Sep-09 1:37
ankitjain111011-Sep-09 1:37 
AnswerRe: error Pin
Jay Royall11-Sep-09 1:34
Jay Royall11-Sep-09 1:34 
AnswerRe: error Pin
J4amieC11-Sep-09 3:35
J4amieC11-Sep-09 3:35 
Questionvisibility false of a column in gridview Pin
shankbond11-Sep-09 1:02
shankbond11-Sep-09 1:02 
AnswerRe: visibility false of a column in gridview Pin
Meetu Choudhary11-Sep-09 1:29
Meetu Choudhary11-Sep-09 1:29 
GeneralRe: visibility false of a column in gridview Pin
shankbond11-Sep-09 1:58
shankbond11-Sep-09 1:58 
AnswerRe: visibility false of a column in gridview Pin
Meetu Choudhary11-Sep-09 2:02
Meetu Choudhary11-Sep-09 2:02 
RantRe: visibility false of a column in gridview Pin
shankbond11-Sep-09 2:59
shankbond11-Sep-09 2:59 

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.