User Administration
Back to Admin Control Panel
  "Rudy Mark" wrote in message news:eR7rJfKiDHA.1864@TK2MSFTNGP10.phx.gbl...[quote] > Does anybody point me to datagrid sample with editable cell ? > rudy > >[/quote] [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => n newton [ip] => nnewton@nottsrc [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 2 [islastshown] => 1 [isfirstshown] => [attachments] => [allattachments] => ) --> Editable rows....... for datagrid.... - ASP.NET Data Grid Control

Editable rows....... for datagrid.... - ASP.NET Data Grid Control

Does anybody point me to datagrid sample with editable cell ? rudy...

Sponsored Links
  1. #1

    Default Editable rows....... for datagrid....

    Does anybody point me to datagrid sample with editable cell ?
    rudy


    Sponsored Links
    Rudy Mark Guest

  2. #2

    Default Re: Editable rows....... for datagrid....

    Heres one
    <% Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1"
    %>
    <% import Namespace="System.Data" %>
    <% import Namespace="System.Data.OLeDb" %>
    <script runat="server">

    dim Conn as new
    OleDbConnection(ConfigurationSettings.AppSettings( "connection_users"))

    sub Page_Load(Sender as Object, e as EventArgs)

    FillDataGrid()

    end sub



    sub dgData_Edit(sender as Object, e as DataGridCommandEventArgs)
    FillDataGrid(e.Item.ItemIndex)
    end sub

    sub dgData_Delete(sender as Object, e as DataGridCommandEventArgs)
    dim strSQL as string = "DELETE FROM users WHERE userid = " &
    Ctype(e.Item.Cells(0).Controls(1), Label).text



    ExecuteStatement(strSQL)

    FillDataGrid()
    end sub

    sub dgData_Update(Sender as Object, e as DataGridCommandEventArgs)
    if UpdateDataStore(e) then
    FillDataGrid(-1)
    end if
    end sub

    sub dgData_Cancel(Sender as Object, e as DataGridCommandEventArgs)
    FillDataGrid(-1)
    end sub

    sub dgData_PageIndexChanged(Sender as Object, e as
    DataGridPageChangedEventArgs)
    dgData.CurrentPageIndex = e.NewPageIndex
    dgData.DataBind()
    end sub

    function UpdateDataStore(e as DataGridCommandEventArgs) as boolean

    dim i, j as integer
    dim params(9) as string
    dim strText as string
    dim blnGo as boolean = True

    j = 0

    for i = 1 to e.Item.Cells.Count - 3
    strText = Ctype(e.Item.Cells(i).Controls(0),
    TextBox).Text
    if strText <> "" then
    params(j) = strText
    j = j + 1
    else
    blnGo = False
    lblMessage.Text = lblMessage.Text & "You
    forgot to enter a value<p>"
    end if

    next

    if not blnGo then
    return false
    exit function
    end if

    dim objUser as new console.User
    dim objUserDetails as new console.UserDetails
    objUser.Connection_String =
    ConfigurationSettings.AppSettings("connection_user s")


    with objUserDetails
    .userid = Ctype(e.Item.Cells(0).Controls(1), Label).Text
    .username = params(0)
    .password = params(1)
    .firstname = params(2)
    .lastname = params(3)
    .email = params(4)
    .telephone = params(5)
    .organisation = params(6)
    .choice = params(7)
    .active = params(8)
    end with
    objUser.UpdateDetails(objUserDetails)
    return blnGo

    end function

    sub FillDataGrid(Optional EditIndex as integer =- 1)
    dim objCmd as new OleDbCommand("select * from
    users", Conn)



    objCmd.Connection.Open()
    Dim myAdapter as New OleDbDataAdapter(objcmd)
    Dim ds as New DataSet()
    myAdapter.Fill(ds)



    dgData.DataSource = ds
    if not EditIndex.Equals(Nothing) then
    dgData.EditItemIndex = editIndex
    end if

    dgData.DataBind()


    objCmd.Connection.Close()

    end sub

    function ExecuteStatement(strSQL)

    dim objCmd as new OleDbCommand(strSQL, Conn)

    try
    objCmd.Connection.Open()
    objCmd.ExecuteNonQuery()
    catch ex as exception
    lblMessage.Text = "Error updating the database"
    end try

    objCmd.Connection.Close()

    end function

    </script>
    <html>
    <head>
    <title>The Knowledge Network</title>
    <meta http-equiv="Content-Type" content="text/html; cht=iso-8859-1">
    <link rel="stylesheet" type="text/css" href="../images/emraf.css">
    </head>
    <body bgcolor="#FFFFFF">

    <!--Main content cell-->
    <table width="100%" height="100%" border="0" cellspacing="10">
    <!--DWLayoutTable-->
    <tr>
    <td width="33%" height="282" valign="top">
    <font face="arial" size="3"><b>User Administration</b></font>
    <br><a href="admin.aspx">Back to Admin Control Panel</a>
    <!--News Cell-->
    <asp:Label id="lblMessage" runat="server"/>
    <form runat="server">

    <asp:DataGrid id="dgData" runat="server"
    BorderColor="Black" Gridlines="Both"
    AllowPaging="true" PageSize="5" PagerStyle-Mode="NumericPages"
    ItemStyle-Font-Name="Verdana" ItemStyle-Font-Size="8"
    EditItemStyle-Font-Name="Verdana" EditItemStyle-Font-Size="8"
    cellpadding="4" CellSpacing="0" width="100%"
    AutoGenerateColumns="False"
    OnDeleteCommand="dgData_Delete"
    OnEditCommand="dgData_Edit"
    OnCancelCommand="dgData_Cancel"
    OnUpdateCommand="dgData_Update"
    OnPageIndexChanged="dgData_PageIndexChanged">

    <Columns>
    <asp:templatecolumn HeaderText="ID">
    <Itemtemplate>
    <asp:label id="Name" runat="server"
    Text='<%# Container.DataItem("userid") %>' />
    </ItemTemplate>
    </asp:templateColumn>
    <asp:BoundColumn HeaderText="Username"
    DataField="username" />
    <asp:boundcolumn HeaderText="Password"
    DataField="password" />
    <asp:boundcolumn HeaderText="First Name"
    DataField="firstname" />
    <asp:boundcolumn HeaderText="Last Name"
    DataField="lastname" />
    <asp:boundcolumn HeaderText="E-mail"
    DataField="email" />
    <asp:boundcolumn HeaderText="Telephone"
    DataField="telephone" />
    <asp:boundcolumn HeaderText="Organisation"
    DataField="organisation" />
    <asp:boundcolumn HeaderText="Choices"
    DataField="choice" />
    <asp:boundcolumn HeaderText="Active"
    DataField="active" />
    <asp:EditCommandColumn
    EditText="Edit"
    CancelText="Cancel"
    UpdateText="Update"
    HeaderText="Edit" />
    <asp:buttoncolumn HeaderText="" text="Delete"
    CommandName="delete" /> </Columns>
    </asp:DataGrid>

    </form></td>
    </tr>
    </table>
    <font size="1" face="Courier New, Courier, mono">
    <!--end main content cell-->
    </font><font size="1" face="Geneva, Arial, Helvetica,
    san-serif">&nbsp; </font></td>
    </tr>
    </table>

    </body>
    </html>

    "Rudy Mark" <RudyMark_77> wrote in message
    news:eR7rJfKiDHA.1864TK2MSFTNGP10.phx.gbl...
    > Does anybody point me to datagrid sample with editable cell ?
    > rudy
    >
    >

    n newton Guest

Similar Threads

  1. DataGrid EditItemCommand : must click twice to make DataGrid Editable
    By Diane in forum ASP.NET Data Grid Control
    Replies: 5
    Last Post: November 9th, 09:54 AM
  2. Making editable datagrid.
    By trialproduct2004@yahoo.com in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: October 13th, 12:00 PM
  3. Editable Datagrid
    By Jesper Stocholm in forum Macromedia Flex General Discussion
    Replies: 7
    Last Post: September 14th, 04:45 AM
  4. Fully editable datagrid
    By Peter Walburn in forum ASP.NET Data Grid Control
    Replies: 12
    Last Post: May 19th, 04:06 PM
  5. How do I assign an editable Checkbox in the datagrid
    By JLeary in forum ASP.NET Data Grid Control
    Replies: 2
    Last Post: July 18th, 03:22 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •