Click here to Skip to main content
15,910,878 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: enum values Pin
boyindie20-Jul-07 5:58
boyindie20-Jul-07 5:58 
GeneralRe: enum values Pin
Fred_Smith20-Jul-07 6:01
Fred_Smith20-Jul-07 6:01 
GeneralRe: enum values Pin
boyindie20-Jul-07 6:19
boyindie20-Jul-07 6:19 
GeneralRe: enum values Pin
Fred_Smith20-Jul-07 6:31
Fred_Smith20-Jul-07 6:31 
GeneralRe: enum values Pin
Fred_Smith20-Jul-07 6:37
Fred_Smith20-Jul-07 6:37 
GeneralRe: enum values Pin
boyindie21-Jul-07 0:50
boyindie21-Jul-07 0:50 
GeneralRe: enum values Pin
Fred_Smith21-Jul-07 4:23
Fred_Smith21-Jul-07 4:23 
GeneralRe: enum values Pin
boyindie21-Jul-07 5:45
boyindie21-Jul-07 5:45 
Heres my code here fred
<code>
Public Sub onEdit(ByVal source As Object, ByVal e As DataGridCommandEventArgs) Handles dgPriv.EditCommand
dgPriv.EditItemIndex = e.Item.ItemIndex
bindGrid()


End Sub

Public Sub oncancel(ByVal source As Object, ByVal e As DataGridCommandEventArgs) Handles dgPriv.CancelCommand
dgPriv.EditItemIndex = -1
bindGrid()

End Sub

Public Sub onUpdate(ByVal source As Object, ByVal e As DataGridCommandEventArgs) Handles dgPriv.UpdateCommand
Dim err As New LiteralControl

If e.Item.ItemType = ListItemType.EditItem Then
Dim lstUpdate As DropDownList = e.Item.FindControl("lstUpdate")
Dim dr As DataRow = e.Item.DataItem

lstUpdate.Items.FindByValue(dr("groups")).Selected = True
End If


Dim SelectedID As String = dgPriv.DataKeys(e.Item.ItemIndex).ToString


Try
Dim cnString As String = "Server=;"

Dim cn As New MySqlConnection(cnString)


'Create mySql command string for passing query or SPROC(Stored Procedure)
Dim cmdString As New MySqlCommand
'Set Command to equal mySql connection, so can pass SQL query
cmdString.Connection = cn
'Set command string to equal SPROC
cmdString.CommandText = "sp_update"
'ONLY PLACE THIS IF SPROC, sets the command to a SPROC
cmdString.CommandType = CommandType.StoredProcedure

Dim param As MySqlParameter

param = cmdString.Parameters.Add("?p_userid", MySqlDbType.Int64)
param.Direction = ParameterDirection.Input
param.Value = dgPriv.DataKeys(e.Item.ItemIndex)

param = cmdString.Parameters.Add("?p_groups", MySqlDbType.VarChar)
param.Direction = ParameterDirection.Input
param.Value = SelectedID

cn.Open()
cmdString.ExecuteNonQuery()
cn.Close()



Catch ex As Exception
err.Text = ex.Message
MsgBox(ex.Message)

End Try

dgPriv.EditItemIndex = -1
bindGrid()



End Sub




</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>

<form id="form1" runat="server">
<div>
<asp:datagrid id="dgPriv" runat="server" BorderWidth="0"
CellPadding="4" Width="100%"
Font-Size="Smaller"
HeaderStyle-HorizontalAlign="Center"
HeaderStyle-Font-Bold="True"
HeaderStyle-BackColor="Navy"
HeaderStyle-ForeColor="White"
datakeyfield ="userId"
AlternatingItemStyle-BackColor="ActiveBorder"
AllowPaging="True"
AllowSorting="True"
AutoGenerateColumns="False" >

<Columns>
<asp:BoundColumn DataField ="userId" HeaderText="User ID" ReadOnly="true"></asp:BoundColumn>
<asp:BoundColumn DataField ="username" HeaderText="User Name" ReadOnly="true"></asp:BoundColumn>
<asp:BoundColumn DataField ="groups" HeaderText="Privelages" ReadOnly="true"></asp:BoundColumn>

<asp:TemplateColumn HeaderText="Update Privelages">
<EditItemTemplate>

<asp:DropDownList runat=server id="listUpdate" DataMember='<%#convert.tostring(databinder.eval(container.dataitem,"groups")) %>' >
<asp:ListItem Value="Admin">Admin</asp:ListItem>
<asp:ListItem Value ="User" >User</asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>
</asp:TemplateColumn>

<asp:EditCommandColumn ButtonType="PushButton" EditText="Change Privelage" UpdateText="Change" CancelText ="cancel" >
</asp:EditCommandColumn>

</Columns>
<PagerStyle HorizontalAlign="Left" />
<AlternatingItemStyle BackColor="ActiveBorder" />
<HeaderStyle BackColor="Navy" Font-Bold="True" ForeColor="White" HorizontalAlign="Center" />


</asp:datagrid>></code>

GeneralRe: enum values Pin
Fred_Smith21-Jul-07 6:15
Fred_Smith21-Jul-07 6:15 
QuestionThreads and browser activity Pin
N a v a n e e t h20-Jul-07 3:16
N a v a n e e t h20-Jul-07 3:16 
AnswerRe: Threads and browser activity Pin
Dave Kreskowiak20-Jul-07 7:31
mveDave Kreskowiak20-Jul-07 7:31 
QuestionError while debug mode entering Pin
tradakad20-Jul-07 3:15
tradakad20-Jul-07 3:15 
AnswerRe: Error while debug mode entering Pin
Mr Saqib Mushtaq20-Jul-07 3:37
Mr Saqib Mushtaq20-Jul-07 3:37 
GeneralRe: Error while debug mode entering Pin
tradakad21-Jul-07 0:03
tradakad21-Jul-07 0:03 
JokeRe: Error while debug mode entering [modified] Pin
tradakad21-Jul-07 1:54
tradakad21-Jul-07 1:54 
QuestionUsing threads in a web service Pin
totig20-Jul-07 2:55
totig20-Jul-07 2:55 
GeneralRe: Using threads in a web service Pin
Colin Angus Mackay20-Jul-07 3:01
Colin Angus Mackay20-Jul-07 3:01 
AnswerRe: Using threads in a web service Pin
Colin Angus Mackay20-Jul-07 3:00
Colin Angus Mackay20-Jul-07 3:00 
GeneralRe: Using threads in a web service Pin
totig20-Jul-07 3:07
totig20-Jul-07 3:07 
Questionsession timeout redirect Pin
boyindie20-Jul-07 2:45
boyindie20-Jul-07 2:45 
AnswerRe: session timeout redirect Pin
Mr Saqib Mushtaq20-Jul-07 2:55
Mr Saqib Mushtaq20-Jul-07 2:55 
GeneralRe: session timeout redirect Pin
boyindie20-Jul-07 3:13
boyindie20-Jul-07 3:13 
Questiondatabase table listings. Pin
Sonia Gupta20-Jul-07 1:58
Sonia Gupta20-Jul-07 1:58 
AnswerRe: database table listings. Pin
N a v a n e e t h20-Jul-07 2:11
N a v a n e e t h20-Jul-07 2:11 
GeneralRe: database table listings. Pin
Sonia Gupta20-Jul-07 2:25
Sonia Gupta20-Jul-07 2:25 

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.