p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > SharePoint > SharePoint Development
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SharePoint Development Programming and development for SharePoint Portal Server and Windows SharePoint Services

Welcome to the p2p.wrox.com Forums.

You are currently viewing the SharePoint Development section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 7th, 2008, 10:54 AM
Registered User
 
Join Date: May 2008
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default SPGridView

I'm trying to dynamically create a GridView with a checkboxes that fires when click however, my onclick event is not being triggered.


Protected Overrides Sub RenderContents(ByVal writer As System.Web.UI.HtmlTextWriter)

            oGrid.ID = "grid"
            oGrid.AutoGenerateColumns = False
            oGrid.Columns.Clear()

            Dim tf1 As TemplateField = New TemplateField
            tf1.HeaderText = "Account Status"
            tf1.ItemTemplate = New GridViewTemplate(DataControlRowType.DataRow, "isDisabled")
            oGrid.Columns.Add(tf1)

....
End Sub

Sub InstantiateIn(ByVal container As System.Web.UI.Control) Implements ITemplate.InstantiateIn
        Select Case templateType
            Case DataControlRowType.DataRow
                Dim cb As CheckBox = New CheckBox
                cb.ID = "cbStatus"
                cb.AutoPostBack = True
                cb.EnableViewState = True
                AddHandler cb.DataBinding, AddressOf BindCheckBox
                AddHandler cb.CheckedChanged, New EventHandler(AddressOf CheckedChanged)
                container.Controls.Add(cb)
        End Select
    End Sub


    Public Sub CheckedChanged(ByVal sender As Object, ByVal e As EventArgs)
        Dim data As New AdminParentAcctData(GetConnectionString())
        Dim StudentId As String = String.Empty
        Dim stdnt As New Student(GetConnectionString())

        Dim cb As CheckBox = CType(sender, CheckBox)
        Dim row As GridViewRow = CType(cb.NamingContainer, GridViewRow)

        If cb.Checked = True Then
        Dim username As String = CType(row.Cells(2).Text, String)
        data.updatePermissions(username, Id)
        End If
End Sub
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old April 15th, 2009, 07:14 PM
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default SPGridView: adding custom TemplateField...

Please take a look at one of my blog posts that details how to go about this:

http://www.sharepointace.com/Blog/po...ox-Column.aspx

Cheers,
Oscar
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Paging and Filtering with SPGridView arunduttgp SharePoint Development 1 December 1st, 2008 09:36 PM
How to edit/delete list items through SPGridView meera SharePoint Development 0 December 7th, 2007 11:32 AM



All times are GMT -4. The time now is 08:42 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc