Using different WebUserControls as custom edit form

Thread is closed for posting
6 posts, 0 answers
  1. 63F75A2C-1F16-4AED-AFE8-B1BBD57646AD
    63F75A2C-1F16-4AED-AFE8-B1BBD57646AD avatar
    1572 posts
    Member since:
    Oct 2004

    Posted 27 Apr 2006 Link to this post

     

    Requirements

    RadGrid for ASP .NET version

    3.1.1 and later

    .NET version

    1.x

    Visual Studio version

    2002 and later

    Programming language

    VB.NET

    Browser support

    all supported by RadGrid for ASP .NET


     
    Actually you have one and the same user control but with distinctive set of controls inside it. This project presents how to display file upload edit form when clicking the Upload file link button in an arbitrary grid row:
    1. check whether e.CommandName is the name you specified for your GridButtonColumn
    2. if so, switch the item in edit mode and rebind the grid (saving indicator in the Session for changing the edit form state)
    3. wire the ItemCreated event to verify that the item is in edit mode and the Session flag is raised
    4. clear the Controls collection of the EditFormCell for the GridEditFormItem
    5. add HtmlInputFile control and upload button to the Controls collection of the EditFormCell for the GridEditFormItem

    Note that the demo does not hold real update/file upload. If this is needed, you should include this functionality by writing custom code according to your requirements.

     

  2. 7EEDBA7C-C5D9-43D3-A6EA-A3C717B5491B
    7EEDBA7C-C5D9-43D3-A6EA-A3C717B5491B avatar
    21 posts
    Member since:
    Sep 2012

    Posted 07 May 2006 Link to this post

    Do you have this sample in vs2005 and .net 2.0?
  3. 6AB3838B-B392-4EDE-97F0-B3F5916D8900
    6AB3838B-B392-4EDE-97F0-B3F5916D8900 avatar
    11100 posts
    Member since:
    Jan 2017

    Posted 08 May 2006 Link to this post


    Hello Reggie,

    Actually the core of this example is in these two methods:

    Private Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As Telerik.WebControls.GridCommandEventArgs) Handles RadGrid1.ItemCommand

    If (e.CommandName = RadGrid.EditCommandName) Then
        Session("changeEditForm") = Nothing
    End If

    If (e.CommandName = "UploadFile" AndAlso TypeOf e.Item Is GridDataItem) Then
        e.Item.Edit = True
        Session("changeEditForm") = True
        RadGrid1.Rebind()
    End If

    If (e.CommandName = "Close") Then
        RadGrid1.EditIndexes.Clear()
        RadGrid1.Rebind()
    End If

    End Sub

     

    Private Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As Telerik.WebControls.GridItemEventArgs) Handles RadGrid1.ItemCreated

    If (TypeOf e.Item Is GridEditFormItem AndAlso e.Item.IsInEditMode) Then
        If (Not Session("changeEditForm") Is Nothing) Then

            Dim formItem As GridEditFormItem = CType(e.Item, GridEditFormItem)
            formItem.EditFormCell.Controls.Clear()
            formItem.EditFormCell.Controls.Add(
    New System.Web.UI.HtmlControls.HtmlInputFile)    
            formItem.EditFormCell.Controls.Add(
    New LiteralControl("<br/>"))

            Dim
    uploadButton As Button = New Button

            uploadButton.Text = "Upload file"

            uploadButton.CommandName = "Upload"

            formItem.EditFormCell.Controls.Add(uploadButton)

            Dim closeButton As Button = New Button

            closeButton.Text = "Close"

            closeButton.CommandName = "Close"

            formItem.EditFormCell.Controls.Add(closeButton)

        End If

    End If

    End Sub

    and you can easily use them in VS.NET 2005.

    Regards,
    Stephen,
    the telerik team
  4. 7EEDBA7C-C5D9-43D3-A6EA-A3C717B5491B
    7EEDBA7C-C5D9-43D3-A6EA-A3C717B5491B avatar
    21 posts
    Member since:
    Sep 2012

    Posted 08 May 2006 Link to this post

    Hi Vlad
    Thanks for the Heads Up!  What I am trying to do is use a grid as a data entry form that will allow a user to update 1 record. (No insert or delete required)  Do you have any other articles that will help me to understand how to do this.  Thanks

  5. C7498A83-7E2E-418C-8791-93EF573A7569
    C7498A83-7E2E-418C-8791-93EF573A7569 avatar
    9934 posts
    Member since:
    Nov 2016

    Posted 08 May 2006 Link to this post


    Hello Reggie,

    We believe that the following topics from the grid online documentation can help you understand the specifics of the edit/update mechanism of r.a.d.grid:

    http://www.telerik.com/help/radgrid/3.2.Net2/ (section Insert/Update/Delete)

    Best regards,
    Stephen
    the telerik team
  6. C7498A83-7E2E-418C-8791-93EF573A7569
    C7498A83-7E2E-418C-8791-93EF573A7569 avatar
    9934 posts
    Member since:
    Nov 2016

    Posted 10 May 2006 Link to this post


    Hi folks,

    Here is the C# version of this example (under .NET 1.x framework) which has been kindly provided by Mostafa Anoosheh. Feel free to use that version in case this is the programming language you choose.

    And happy coding :)
     
    Best,
    Stephen
    the telerik team
Back to Top

This Code Library is part of the product documentation and subject to the respective product license agreement.