Click here to Skip to main content
16,008,183 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: CINT Pin
Dave Kreskowiak8-Sep-05 1:56
mveDave Kreskowiak8-Sep-05 1:56 
Answer[Message Deleted] Pin
Steve Pullan7-Sep-05 19:05
Steve Pullan7-Sep-05 19:05 
QuestionChange Font map on windows Pin
dmtuan7-Sep-05 17:15
dmtuan7-Sep-05 17:15 
QuestionRichTextBox FontStyles Pin
Taen_Karth7-Sep-05 15:23
Taen_Karth7-Sep-05 15:23 
AnswerRe: RichTextBox FontStyles Pin
Taen_Karth7-Sep-05 15:59
Taen_Karth7-Sep-05 15:59 
Questionsome guidance in making project setup Pin
monica2k7-Sep-05 14:39
monica2k7-Sep-05 14:39 
QuestionHow to delete a row from a datagrid:-( Pin
macupryk7-Sep-05 14:38
macupryk7-Sep-05 14:38 
AnswerRe: How to delete a row from a datagrid:-( Pin
mcgann8-Sep-05 4:54
mcgann8-Sep-05 4:54 
ok i hope this helps.

<asp:datagrid id="dgResults" runat="server" width="100%" autogeneratecolumns="False" ondeletecommand="dgResults_Delete" datakeyfield="form_id">
<alternatingitemstyle backcolor="#C0C0FF">
<itemstyle backcolor="#8080FF">
<headerstyle backcolor="Gainsboro">
<columns>
<asp:boundcolumn datafield="form_id" headertext="Form ID"><headerstyle width="65px">
<asp:boundcolumn datafield="hazard" headertext="Hazard Name">
<asp:boundcolumn datafield="description" headertext="Hazard Description">
<asp:buttoncolumn text="Delete Form" buttontype="LinkButton" commandname="delete">
<headerstyle width="80px">




this is the datagrid that i used in a recent project add this or something similar to the html.Make sure to add the onDeleteCommand & DataKeyField(this is the id of a column in your database).

then add the following to the code behind page.

Sub dgResults_Delete(ByVal Sender As Object, ByVal E As DataGridCommandEventArgs)
Dim Selectedform_id As String = dgResults.DataKeys(E.Item.ItemIndex)
conn.Open()
Try
Dim command As New SqlCommand("DeleteForm", conn)
command.CommandType = CommandType.StoredProcedure

command.Parameters.Add("@form_id", dgResults.DataKeys(E.Item.ItemIndex))

command.Parameters.Add("@form_id", dgResults.DataKeys(E.Item.ItemIndex))
Finally
conn.Close
End Try

''write statement to rebind the datgrid once deleted. Also notice that i used a stored procedure to delete the details in the database.

Hope this is helpful if not give me another shout.




gfhg
QuestionOdbc Parameter error Pin
Mark067-Sep-05 11:53
Mark067-Sep-05 11:53 
QuestionOutlook Mapi older failure Pin
Member 20812627-Sep-05 10:53
Member 20812627-Sep-05 10:53 
QuestionForm Height Pin
No-e7-Sep-05 5:31
No-e7-Sep-05 5:31 
AnswerRe: Form Height Pin
Dave Kreskowiak7-Sep-05 5:39
mveDave Kreskowiak7-Sep-05 5:39 
GeneralRe: Form Height Pin
No-e7-Sep-05 5:45
No-e7-Sep-05 5:45 
QuestionHow do you hide a tabPage within a tabcontrol Pin
directred7-Sep-05 4:06
directred7-Sep-05 4:06 
AnswerRe: How do you hide a tabPage within a tabcontrol Pin
rwestgraham7-Sep-05 11:15
rwestgraham7-Sep-05 11:15 
GeneralRe: How do you hide a tabPage within a tabcontrol Pin
directred8-Sep-05 4:23
directred8-Sep-05 4:23 
GeneralRe: How do you hide a tabPage within a tabcontrol Pin
KaptinKrunch8-Sep-05 8:15
KaptinKrunch8-Sep-05 8:15 
GeneralRe: How do you hide a tabPage within a tabcontrol Pin
rwestgraham9-Sep-05 10:05
rwestgraham9-Sep-05 10:05 
QuestionSorting........ Pin
daviiie7-Sep-05 2:09
daviiie7-Sep-05 2:09 
AnswerRe: Sorting........ Pin
Colin Angus Mackay7-Sep-05 10:42
Colin Angus Mackay7-Sep-05 10:42 
QuestionDisable Insert in Datagrid Pin
Tim Emjay7-Sep-05 1:54
Tim Emjay7-Sep-05 1:54 
AnswerRe: Disable Insert in Datagrid Pin
_mubashir7-Sep-05 5:31
_mubashir7-Sep-05 5:31 
GeneralRe: Disable Insert in Datagrid Pin
Tim Emjay7-Sep-05 6:02
Tim Emjay7-Sep-05 6:02 
QuestionForm TextBox query Pin
directred7-Sep-05 0:59
directred7-Sep-05 0:59 
AnswerRe: Form TextBox query Pin
KaptinKrunch8-Sep-05 8:06
KaptinKrunch8-Sep-05 8:06 

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.