How Do I : add Checkbox updates without using edit/upate/cancel

Discussion in 'ASP .Net Datagrid Control' started by Charles, Jul 10, 2003.

  1. Charles

    Charles Guest

    Hello,
    I need to display rows in a grid and then allow the user
    to click one or more checkboxes, one per column and have
    each click a seperate process/update.
    I DO NOT WHAT TO use the edit mode and then the user
    selects update or cancel. Too many click.

    I am using the datagrid control.
    One click, one SQL update.

    Charles
     
    Charles, Jul 10, 2003
    #1
    1. Advertising

  2. Charles

    J P Deka Guest

    Charles
    This is little tricky for this first make one functions
    (1) Binddata -- the function job is to get datatable and bind it.

    here is the listing
    -------------------
    Function Binddata()

    Dim bc1 As New BoundColumn()

    Dim bc2 As New BoundColumn()

    Dim tc As New TemplateColumn()



    bc1.DataField = "XXX" /// coulmn name

    bc1.HeaderText = "COL_HEADER"

    bc2.DataField = "XXX"

    bc2.HeaderText = "COL_HEADER"

    tc.ItemTemplate = New checkboxColumn() // this is the template column to
    add the template of checkbox

    dbgrid.Columns.Clear()

    dbgrid.Columns.Add(tc)

    dbgrid.Columns.Add(bc1)

    dbgrid.Columns.Add(bc2)

    'Adding checkbox

    Dim data As DataTable = getTheData() // This function will get the data and
    return the datatable

    dbgrid.DataSource = data

    dbgrid.AutoGenerateColumns = False

    dbgrid.DataBind()

    End Sub

    ----------------------------------------------------------------------------
    -------------



    Now add this class to the Module

    Public Class checkboxColumn

    Implements ITemplate

    Public Sub New()

    End Sub

    Sub instantiatein(ByVal container As Control) Implements
    ITemplate.InstantiateIn

    Dim dyncb As CheckBox = New CheckBox()

    AddHandler dyncb.DataBinding, AddressOf BindCheckBoxColumn

    container.Controls.Add(dyncb)

    End Sub

    Public Sub BindCheckBoxColumn(ByVal sender As Object, ByVal e As EventArgs)

    Dim dyncb As CheckBox = CType(sender, CheckBox)

    Dim container As DataGridItem = CType(dyncb.NamingContainer, DataGridItem)

    End Sub

    End Class

    ________________________________________________________________

    If you face any further problem let me know..at ()

    ----
    Jyoti Prakash Deka
    NIIT Ltd.
    India




    "Charles" <> wrote in message
    news:047801c3466e$deb11540$...
    > Hello,
    > I need to display rows in a grid and then allow the user
    > to click one or more checkboxes, one per column and have
    > each click a seperate process/update.
    > I DO NOT WHAT TO use the edit mode and then the user
    > selects update or cancel. Too many click.
    >
    > I am using the datagrid control.
    > One click, one SQL update.
    >
    > Charles
    >
     
    J P Deka, Jul 10, 2003
    #2
    1. Advertising

  3. Hello Charles,

    You could also refer to these materials for how to customize datagrid
    control:

    DataGrid Control FAQ:

    There are quite a few good examples around. Here are some links:

    Top Questions About the DataGrid Web Server Control
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechar
    t/html/vbtchtopquestionsaboutaspnetdatagridservercontrol.asp
    Contents
    Windows Forms versus Web Forms DataGrid Controls
    Controlling Column Width, Height, and Alignment
    Customizing Column Layout in Display and Edit Mode
    Formatting Dates, Currency, and Other Data
    Showing and Hiding Columns Dynamically
    Adding Columns Dynamically
    Adding New Records to a Data Source Using the DataGrid Control
    Displaying a Drop-Down List in Edit Mode
    Selecting Multiple Items Using a Check Box (Hotmail Model)
    Editing Multiple Rows At Once
    Selecting Rows by Clicking Anywhere

    Cutting Edge: Server-side ASP.NET Data Binding, Part 2: Customizing
    the DataGrid Control
    http://msdn.microsoft.com/library/en-us/dnmag01/html/cutting0104.asp

    Summary Rows in DataGrid Controls
    http://msdn.microsoft.com/library/en-us/dndive/html/data01102002.asp

    Cutting Edge: Custom Web Data Reporting
    http://msdn.microsoft.com/library/en-us/dnmag01/html/cutting0107.asp

    Cutting Edge: A Truly Excel-like Grid Control
    http://msdn.microsoft.com/library/en-us/dndive/html/data02142002.asp

    Hope it helps.
    Best regards,
    yhhuang
    VS.NET, Visual C++
    Microsoft

    This posting is provided "AS IS" with no warranties, and confers no rights.
    Got .Net? http://www.gotdotnet.com
    --------------------
    !Content-Class: urn:content-classes:message
    !From: "Charles" <>
    !Sender: "Charles" <>
    !Subject: How Do I : add Checkbox updates without using edit/upate/cancel
    !Date: Wed, 9 Jul 2003 16:07:29 -0700
    !Lines: 12
    !Message-ID: <047801c3466e$deb11540$>
    !MIME-Version: 1.0
    !Content-Type: text/plain;
    ! charset="iso-8859-1"
    !Content-Transfer-Encoding: 7bit
    !X-Newsreader: Microsoft CDO for Windows 2000
    !Thread-Index: AcNGbt6x1CIxO+afQN635+8lklhbvQ==
    !X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
    !Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridcontrol
    !Path: cpmsftngxa06.phx.gbl
    !Xref: cpmsftngxa06.phx.gbl
    microsoft.public.dotnet.framework.aspnet.datagridcontrol:5608
    !NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165
    !X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridcontrol
    !
    !Hello,
    ! I need to display rows in a grid and then allow the user
    !to click one or more checkboxes, one per column and have
    !each click a seperate process/update.
    ! I DO NOT WHAT TO use the edit mode and then the user
    !selects update or cancel. Too many click.
    !
    ! I am using the datagrid control.
    ! One click, one SQL update.
    !
    !Charles
    !
    !
     
    Yan-Hong Huang[MSFT], Jul 10, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?U3RldmUgS2FsbGFs?=

    CssClass on DataGrid Edit, Update & Cancel buttons

    =?Utf-8?B?U3RldmUgS2FsbGFs?=, Jul 6, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    732
    =?Utf-8?B?U3RldmUgS2FsbGFs?=
    Jul 6, 2004
  2. =?Utf-8?B?SmFjcXVlcyBMZWNsZXJj?=

    RE: Setting CssClass on Edit, Update & Cancel buttons

    =?Utf-8?B?SmFjcXVlcyBMZWNsZXJj?=, Jul 6, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    503
    =?Utf-8?B?SmFjcXVlcyBMZWNsZXJj?=
    Jul 6, 2004
  3. Craig G
    Replies:
    2
    Views:
    673
    Patrick Olurotimi Ige
    Dec 14, 2004
  4. =?Utf-8?B?cG11ZA==?=

    CANT see EDIT UPDATE CANCEL Buttons for DATAGRID

    =?Utf-8?B?cG11ZA==?=, Dec 28, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    2,404
    =?Utf-8?B?cG11ZA==?=
    Dec 28, 2004
  5. John Dalberg
    Replies:
    0
    Views:
    383
    John Dalberg
    Dec 20, 2005
Loading...

Share This Page