Click here to Skip to main content
15,907,392 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: how to solved server 500 error Pin
SHatchard17-Jul-07 23:36
SHatchard17-Jul-07 23:36 
AnswerRe: how to solved server 500 error Pin
chapathi17-Jul-07 23:38
chapathi17-Jul-07 23:38 
GeneralRe: how to solved server 500 error Pin
Piyush Vardhan Singh18-Jul-07 0:49
Piyush Vardhan Singh18-Jul-07 0:49 
QuestionHow can i make licenseing for Web Application in ASP.NET Pin
sachinpatel1617-Jul-07 23:07
sachinpatel1617-Jul-07 23:07 
AnswerRe: How can i make licenseing for Web Application in ASP.NET Pin
N a v a n e e t h17-Jul-07 23:19
N a v a n e e t h17-Jul-07 23:19 
GeneralRe: How can i make licenseing for Web Application in ASP.NET Pin
sachinpatel1617-Jul-07 23:31
sachinpatel1617-Jul-07 23:31 
GeneralRe: How can i make licenseing for Web Application in ASP.NET Pin
N a v a n e e t h17-Jul-07 23:56
N a v a n e e t h17-Jul-07 23:56 
Questionhow can i handle mutliple datagrid events? Pin
boyindie17-Jul-07 22:59
boyindie17-Jul-07 22:59 
Hi
I have produced a table which allows me to select the current user or delete the user from the table

But i am unsure how to handle both events, i have the delete working, but when i try to run the select method, it will run both the delete and select methods, how do I handle these correctly my asp code is as follows

<asp:TemplateColumn HeaderText="Delete User">
<ItemTemplate >
<asp:linkbutton id="cmdDel" runat="server">Delete</asp:linkbutton>
</ItemTemplate></asp:TemplateColumn>
<asp:TemplateColumn HeaderText ="View user Profile">
<ItemTemplate>
<asp:LinkButton ID="cmdSelect" runat="server" >Select</asp:LinkButton></ItemTemplate></asp:TemplateColumn>
</Columns>
<PagerStyle HorizontalAlign="Left" />
<AlternatingItemStyle BackColor="ActiveBorder" />
<HeaderStyle BackColor="Navy" Font-Bold="True" ForeColor="White" HorizontalAlign="Center" />

</asp:datagrid>

and my vb code is
Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As DataGridItemEventArgs) Handles dgPriv.ItemDataBound
Dim l As LinkButton
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
l = CType(e.Item.Cells(6).FindControl("cmdDel"), LinkButton)
l.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');")
End If
End Sub


Sub dgpriv_ItemCommand(ByVal sender As Object, ByVal e As DataGridCommandEventArgs) Handles dgPriv.ItemCommand

Dim iid As Integer = dgPriv.DataKeys(e.Item.ItemIndex)
Dim litErr As New Literal
Dim myConnection As New MySqlConnection("Server=localhost;;database=ftp1;")
Try

Dim param As New MySqlParameter
Dim myDeleteCommand As MySqlCommand = New MySqlCommand("sp_delete", myConnection)
myDeleteCommand.CommandType = CommandType.StoredProcedure

param = myDeleteCommand.Parameters.Add("?p_id", MySqlDbType.VarChar)
param.Direction = ParameterDirection.Input
param.Value = iid


myConnection.Open() 'Open the connection
myDeleteCommand.ExecuteNonQuery() 'Delete the record
myConnection.Close() 'Close the connection

Catch ex As Exception
litErr.Text = ex.Message
MsgBox(ex.Message)
End Try


refresh()
End Sub


Sub getUser(ByVal sender As Object, ByVal e As DataGridCommandEventArgs) Handles dgPriv.ItemCommand
MsgBox(dgPriv.DataKeys(e.Item.ItemIndex))


End Sub


AnswerRe: how can i handle mutliple datagrid events? Pin
N a v a n e e t h17-Jul-07 23:08
N a v a n e e t h17-Jul-07 23:08 
AnswerRe: how can i handle mutliple datagrid events? Pin
Amit.Amit.Amit...18-Jul-07 0:56
Amit.Amit.Amit...18-Jul-07 0:56 
QuestionCrystal Report Query Pin
isaii17-Jul-07 22:51
isaii17-Jul-07 22:51 
AnswerRe: Crystal Report Query Pin
N a v a n e e t h17-Jul-07 23:01
N a v a n e e t h17-Jul-07 23:01 
Questionmail Pin
Pallavi Bhoite17-Jul-07 22:45
Pallavi Bhoite17-Jul-07 22:45 
AnswerRe: mail Pin
Michael Sync18-Jul-07 1:14
Michael Sync18-Jul-07 1:14 
GeneralRe: mail Pin
Pallavi Bhoite18-Jul-07 1:19
Pallavi Bhoite18-Jul-07 1:19 
GeneralRe: mail Pin
Michael Sync18-Jul-07 1:27
Michael Sync18-Jul-07 1:27 
GeneralRe: mail Pin
Pallavi Bhoite18-Jul-07 3:03
Pallavi Bhoite18-Jul-07 3:03 
QuestionDynamically adding custom controls to a aspx page (C#) Pin
But_Im_a_Lady17-Jul-07 22:25
But_Im_a_Lady17-Jul-07 22:25 
AnswerRe: Dynamically adding custom controls to a aspx page (C#) Pin
N a v a n e e t h17-Jul-07 22:41
N a v a n e e t h17-Jul-07 22:41 
GeneralRe: Dynamically adding custom controls to a aspx page (C#) Pin
But_Im_a_Lady17-Jul-07 23:01
But_Im_a_Lady17-Jul-07 23:01 
GeneralRe: Dynamically adding custom controls to a aspx page (C#) Pin
N a v a n e e t h18-Jul-07 0:25
N a v a n e e t h18-Jul-07 0:25 
QuestionHow to: Simple Database Connection Pin
totocaster17-Jul-07 21:43
totocaster17-Jul-07 21:43 
AnswerRe: How to: Simple Database Connection Pin
Paddy Boyd17-Jul-07 22:33
Paddy Boyd17-Jul-07 22:33 
AnswerRe: How to: Simple Database Connection Pin
mavii18-Jul-07 0:17
mavii18-Jul-07 0:17 
AnswerRe: How to: Simple Database Connection Pin
mavii18-Jul-07 0:22
mavii18-Jul-07 0:22 

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.