Boyet dot Net
I am working on a webpart to process our user agreements(XML form signed by new users requesting an account). However, for some reason the cancel & update events are not firing. I have attached event handlers, but still get nothing for those two. The edit and sort commands will fire. Anyone have any ideas?
I have tried it with the onitemcommand code below. Still nothing comes through there but edit commands.
Imports System
Imports System.ComponentModel
Imports System.IO
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Xml.Serialization
Imports Microsoft.SharePoint
Imports Microsoft.SharePoint.Utilities
Imports Microsoft.SharePoint.WebControls
Imports Microsoft.SharePoint.WebPartPages
'Imports EU.SharePoint.Utilities
'Description for AccountCreator.
"), XmlRoot(Namespace:="EU.SharePoint.UI.WebParts.AccountCreator")> _
Public Class AccountCreator
Inherits Microsoft.SharePoint.WebPartPages.WebPart
Private Const _defaultText As String = ""
Dim _text As String = _defaultText
_
Property [Text]() As String
Get
Return _text
End Get
Set(ByVal Value As String)
_text = Value
End Set
End Property
'This method gets the custom tool parts for this Web Part by overriding the
'GetToolParts method of the WebPart base class. You must implement
'custom tool parts in a separate class that derives from
'Microsoft.SharePoint.WebPartPages.ToolPart.
'Returns an array of references to ToolPart objects.
Public Overrides Function GetToolParts() As ToolPart()
Dim toolParts(2) As ToolPart
Dim wptp As WebPartToolPart = New WebPartToolPart
Dim custom As CustomPropertyToolPart = New CustomPropertyToolPart
toolParts(0) = wptp
toolParts(1) = custom
'AccountCreator ToolPart is added here
toolParts(2) = New AccountCreatorTP
Return toolParts
End Function
'Render this Web Part to the output parameter specified.
Protected WithEvents _dgReqs As DataGrid
Private _dsReqs As DataSet
Private _lbl As Label
Private _col As BoundColumn
Protected _edtCol As EditCommandColumn
Private Const VS_Cur_Sort_Ord As String = "CurrentSortOrder"
Private Const VS_Cur_Sort_Exp As String = "CurrentSortExpression"
Private _CurSortOrd As String
Private _CurSortExp As String
Private _list As SPList
Private _web As SPWeb
Private _dv As DataView
'build toolpart to set this value
Private _fields() As String
Protected Overrides Sub RenderWebPart(ByVal output As System.Web.UI.HtmlTextWriter)
EnsureChildControls()
_dgReqs.RenderControl(output)
_lbl.RenderControl(output)
End Sub
Protected Overrides Sub CreateChildControls()
'Get the references to the web and List where the User Agreements are stored
_web = SPControl.GetContextWeb(context)
'The list name should be set from the tool part
_list = _web.Lists("User Request form")
'Set the current sort order and expression
Dim SortOrd As String = CStr(viewstate(VS_Cur_Sort_Ord))
Dim SortExp As String = CStr(viewstate(VS_Cur_Sort_Exp))
Try
If SortOrd "" Then
Me._CurSortOrd = SortOrd
Else
Me._CurSortOrd = enuSortOrd.ASC.ToString
End If
If SortExp "" Then
Me._CurSortExp = SortExp
Else
'Ideally this would be set in the tool part
Me._CurSortExp = "Last"
End If
Catch ex As Exception
End Try
'Save the sort order and expression in the viewstate
viewstate(VS_Cur_Sort_Ord) = _CurSortOrd
viewstate(VS_Cur_Sort_Exp) = _CurSortExp
'Create the DataGrid
If _dgReqs Is Nothing Then
_dgReqs = New DataGrid
With _dgReqs
.AllowSorting = True
.AllowPaging = True
.AutoGenerateColumns = False
End With
End If
'Create the edit column
_edtCol = New EditCommandColumn
With Me._edtCol
.ButtonType = ButtonColumnType.LinkButton
.EditText = "Edit"
.CancelText = "Cancel"
.HeaderText = "Actions"
.UpdateText = "Update"
.Visible = True
End With
_dgReqs.Columns.Add(_edtCol)
AddHandler _dgReqs.EditCommand, New DataGridCommandEventHandler(AddressOf Me._dgReqs_EditCommand)
AddHandler _dgReqs.UpdateCommand, New DataGridCommandEventHandler(AddressOf Me._dgReqs_UpdateCommand)
AddHandler _dgReqs.CancelCommand, New DataGridCommandEventHandler(AddressOf Me._dgReqs_CancelCommand)
AddHandler _dgReqs.SortCommand, New DataGridSortCommandEventHandler(AddressOf Me._dgReqs_SortCommand)
'Create the data columns
If _fields Is Nothing Then
_fields = New String() {"Command", "Rank", "Last", "First", "Middle"}
End If
AddCols(_fields)
'Fill and bind the DataGrid
BindData(_CurSortExp, _CurSortOrd)
Controls.Add(_dgReqs)
'Create the label for success/failure reporting
_lbl = New Label
_lbl.Text = Me._CurSortOrd & " " & Me._CurSortExp
Controls.Add(_lbl)
Me.ChildControlsCreated = True
End Sub
Protected Sub AddCols(ByVal fields As String())
For count As Integer = 0 To fields.Length - 1
_col = New BoundColumn
_col.DataField = fields(count)
_col.HeaderText = fields(count)
_col.SortExpression = fields(count)
_dgReqs.Columns.Add(_col)
Next
End Sub
Private Sub BindData(ByVal sortExp As String, ByVal sortOrd As String)
'Create and load the dataset
_dsReqs = New DataSet
For Each li As SPListItem In _list.Items
_dsReqs.ReadXml(New StringReader(OpenItemAsString(li)))
Next
_dsReqs.Tables(0).DefaultView.Sort() = sortExp & " " & sortOrd
'Bind the data
With _dgReqs
.DataSource = _dsReqs.Tables(0).DefaultView
.DataBind()
End With
End Sub
'Public Sub _dgReqs_OnItemCommand(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)
' System.Diagnostics.Debug.Write(e.CommandName)
' Me._lbl.Text = "event fired"
' Dim row As DataRow
' For count As Integer = 0 To _dsReqs.Tables(0).Rows(e.Item.ItemIndex).ItemArray.Length - 1
' _lbl.Text = _lbl.Text & _dsReqs.Tables(0).Rows(e.Item.ItemIndex).ItemArray(count).ToString() & vbCrLf
' Next
' If e.CommandName = "Edit" Then
' _dgReqs.EditItemIndex = e.Item.ItemIndex
' BindData(_CurSortExp, _CurSortOrd)
' Me._lbl.Text = "edit"
' ElseIf e.CommandName = "Cancel" Then
' _dgReqs.EditItemIndex = -1
' BindData(_CurSortExp, _CurSortOrd)
' Me._lbl.Text = "cancel"
' ElseIf e.CommandName = "Update" Then
' _dgReqs.EditItemIndex = -1
' BindData(_CurSortExp, _CurSortOrd)
' Me._lbl.Text = "update"
' End If
'End Sub
Public Shared Function OpenItemAsString(ByVal Item As SPListItem) As String
'Variable used to store the byte array
Dim bytes As Byte()
bytes = Item.File.OpenBinary()
Dim encoding As System.Text.Encoding = System.Text.Encoding.UTF8
Dim str As String = encoding.GetString(bytes)
Return str
End Function
Private Sub _dgReqs_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles _dgReqs.EditCommand
System.Diagnostics.Debug.Write(e.CommandName)
_dgReqs.EditItemIndex = e.Item.ItemIndex
BindData(_CurSortExp, _CurSortOrd)
Me._lbl.Text = "edit fired & " & _dsReqs.Tables(0).DefaultView.Item(e.Item.ItemIndex).Item("Last").ToString
End Sub
Private Sub _dgReqs_SortCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles _dgReqs.SortCommand
Dim NewSortExp As String = e.SortExpression
Dim CurSortOrd As String = CStr(viewstate(VS_Cur_Sort_Ord))
Dim CurSortExp As String = CStr(viewstate(VS_Cur_Sort_Exp))
If NewSortExp = CurSortExp Then
'The sort expressions are the same so reverse the order
If CurSortOrd = "ASC" Then
CurSortOrd = "DESC"
Else
CurSortOrd = "ASC"
End If
Else
'The sort expressions are different so update the sort expression and set asc order
CurSortExp = NewSortExp
CurSortOrd = "ASC"
End If
'Update the viewstate with the new values
viewstate(VS_Cur_Sort_Ord) = CurSortOrd
viewstate(VS_Cur_Sort_Exp) = CurSortExp
'ReBind the data
BindData(CurSortExp, CurSortOrd)
End Sub
Private Sub _dgReqs_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles _dgReqs.UpdateCommand
'Ad constructor goes here
Me._lbl.Text = "Update Fired"
End Sub
Private Sub _dgReqs_CancelCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles _dgReqs.CancelCommand
_dgReqs.EditItemIndex = -1
BindData(_CurSortExp, _CurSortOrd)
Me._lbl.Text = "cancel fired"
End Sub
End Class
With a year and a half left on my contract in italy, the thought of where to go next is definitely something that is on my mind frequently. Yokohama and Austin top the list. However, neither of them are normally on the Saw Doctors schedule. I could quote you a bunch of career or other bs, but not being on the Saw Doctors schedule seems to be a pretty important factor to consider. I miss their show like you don't know. And not JUST their shows, the whole music scene in New England. I just don't see how I can live there again. What do you say guys? Care to add Tokyo/Yokohama, or Austin to your normal tour list?
It doesn't take a lot of time around EJ to notice that he isn't shy about making himself known. In particular, he is fond of giving his own names to almost anything. When he does it, he leaves me with the distinct feeling that he knows exactly what he is doing. Some of his most notable terms are:
monkey book -> reading Curious George
monkey time -> watching Curious George DVD
Choo Choo bike -> riding in the bike trailer
Donkey -> Shrek
Builder -> Bob the builder (not Bob mind you, builder!)
Milk Store -> commissary
There are several others, but these are the ones that come to mind right now. I will update this list as I am reminded of the others.
I haven't really done anything for lent in a couple of years now. The last real significant thing I did for lent was quit smoking. That was 2002.
I happened to be walking through the house today, when it hit me what I will do for the rest of lent this year. I will forego my drive to work and cycle instead. This is exactly the kinf of simplified renewal that lent is about. Hopefully it works out. I am sure that rain will not be fun. However, I am looking forward to trying.
So I log into Amazon to check an order and what do I see? The Saw Doctors have a new album coming out in April! I preordered it right away of course! That prompted me to go back through my SD CDs, I think I pretty much have them all. I got really excited for about 10 seconds. Then I started to realize how long it had been since I saw them in concert. That sucks!
I had a great time every time I saw them. I think the first time was St Paddys day 2002 in Boston. I had found out about them from the web, and bought tickets to the show at the roxy. I thoguht about not going, but a friend of mine said that they were really good. So I drug myself down to Boston just in time to see the opening band leave the stage.
That was when Villians came out. I picked up a copy that night. I think, there was a lot of Guinness involved you know. From day one, I have always been impressed by the energy the band has, as well as the crouds they attract. Between the show that night, and when when I left the states, I think I saw them 6 or 7 times.
The farthest I ever traveled to see them was in Syracuse Ny, something like 8 hours each way. The most fun I ever had seeing them was at the Irish festival in NY, followed very closely by a show they did at the Irish cultural center in Boston.
Now I am in Italy, and I enjoy it here. However, I dont think the music scene anywhere can top the music scene in New England. I used to use Saw Doctors concerts as an excuse to go somewhere and see something new, meet new people. I never met a Saw Doctors fan I didnt like. It was like having some sort of extended family. Damn I miss those shows!!!
Good Luck on your new album guys. Maybe I will catch a performance of it somewhere. (for those of you poor folks who havent had the pleasure of hearing or seeing them perform, check out their website for dates.)
Fast Food Ice Dirtier Than Toilet Water!
It is ironic that I read this today after watching Super Size Me last night. If you haven't seen it, do so. It is an interesting commentary on the state of the American waistline and overall health. Not that I eat fast food much anyway, I think it will be quite a while before I brave that one again.
I have a habit of not turning the alarm completely off when I get up in the morning. It helps to make sure that I am up and moving before I actually turn it off. It also leads to the alarm going off when I am in the shower on a somewhat regular basis.
Last week, it happened again. I was just getting out when I heard it go off. EJ heard it too. Then I hear him say " OH NO! Broken!!". He ran in the bedroom and started messing with the clock. Somehow, he figured out how to turn it off. It was so funny to see him come out of the bedroom, walking like he was 10 feet tall and bulletproof. When he saw me, he looked up with a huge smile on his face and said, "Fixed!" It was great, and funny. Gotta love him.
The second headline says it all. Poor students lose out on college aid? And that is news? bwahahahahahahhaha
I picked up a MCE laptop (HP ZD8000) last month. In that time, I haven't had the time to use the MCE nearly as much as I have used it as a laptop. That being said, I have a new found appreciation for the serial port on the back of my reciever (Yamaha RX-V2300). I have begun to do some digging into writing a plugin to control the reciever. For example, when I play a rock song on MCE, why should I have to set the reiver for the correct input and sound field, when a plugin can do it for me? Taken a step further, aren't there other recievers that offer similar connectivity? Going with that premise, writing a plugin should be done in two parts, the plugin itself, and the driver for the reciver. It seems like there will be a fair amount of abstraction done in between the two pieces to account for what I can imagine would be significantly different levels of functionality with other recievers. Nevertheles, attempting to code this out seems worthwhile for me, and maybe for some others as well.
Since we converted EJ's crib into a toddler bed, we wake up differently now. Instead of going in his room to find him playing in his crib, he now gets up and comes into our room. This morning he climbed into bed with us, looked at me and said, "Dada up, dada up". I looked at him funny. Then he smiled really big and said, "Dada up, PLEASE". I am sure he will start coming in earlier, but it is nice to wake up to his enthusiasm.
Newsfeed display by CaRP |