Editing Child Templates

9 posts, 1 answers
  1. KawaUser
    KawaUser avatar
    57 posts
    Member since:
    Oct 2010

    Posted 28 Mar 2011 Link to this post

    How do you edit templates in a hierarchy view?
  2. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 28 Mar 2011 Link to this post

    Hello,

    Please could you be more specific about what you would like to achieve. For reference, the help topic on programatically binding to hierarchy data can be found here.

    Look forward to hearing back from you
    Richard
  3. UI for WinForms is Visual Studio 2017 Ready
  4. KawaUser
    KawaUser avatar
    57 posts
    Member since:
    Oct 2010

    Posted 28 Mar 2011 Link to this post

    How do you type in the column and commit the information to the DB?

    Thank you,

    Chuck
  5. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 28 Mar 2011 Link to this post

    Hello,

    As long as the column allows editing, then you can click to edit a cell just as you would in the Master Template.
    Commiting the data to the database will depend on how you are dealing with your databadse. E.g. Via an ORM, table adapters etc...

    Regards,
    Richard
  6. KawaUser
    KawaUser avatar
    57 posts
    Member since:
    Oct 2010

    Posted 28 Mar 2011 Link to this post

    I commit it to the database on the cell end edit event using SQL update.

    Thanks,
    Chuck
  7. Answer
    Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 31 Mar 2011 Link to this post

    Hello KawaUser,

    Thank you for writing.

    I am still not sure that I understand your requirement. In case you want to update sql database, please find detailed description how to do that in the following msdn article.

    If this does not help, please provide us with more details of your exact scenario and your goals. 

    Best wishes, Martin Vasilev
    the Telerik team
  8. KawaUser
    KawaUser avatar
    57 posts
    Member since:
    Oct 2010

    Posted 05 May 2011 Link to this post

    I want to do something similar to this, but for the template.

    How do I call the template column?

    If DataGridReject.CurrentColumn.HeaderText = "ADMIN FEE" Then
     
                            Dim header = DataGridReject.CurrentColumn.Name
     
                            If e.Value Is Nothing Then
     
                            ElseIf e.Value.ToString = "1" Then
     
                                Dim updateString As String = "UPDATE REJECT_REPORT SET " + header + " = '1' WHERE REJECT_ID = '" + rejectID + "'"
     
                                conn.Open()
     
                                Dim comm = New SqlCommand(updateString, conn)
                                comm.ExecuteNonQuery()
     
                                conn.Close()
     
                            ElseIf e.Value.ToString = "0" Then
     
                                Dim boxValue As Integer = 0
     
                                Dim updateString As String = "UPDATE REJECT_REPORT SET " + header + " = '0' WHERE REJECT_ID = '" + rejectID + "'"
     
                                conn.Open()
     
                                Dim comm = New SqlCommand(updateString, conn)
                                comm.ExecuteNonQuery()
     
                                conn.Close()
     
                            End If
     
                        End If

    ANSWER:

    If DataGridReject.Templates(0).CurrentColumn.HeaderText = "MATERIAL_NO" Then
     
                   Dim MATERIAL As String = ""
     
               End If
  9. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 10 May 2011 Link to this post

    Hello KawaUser,

    Thank you for sharing your code with us.

    As far as I understand you have managed to find a solution for your requirement. Feel free to write me back if you have any additional questions.

    Greetings,
    Martin Vasilev
    the Telerik team
    Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
  10. KawaUser
    KawaUser avatar
    57 posts
    Member since:
    Oct 2010

    Posted 10 May 2011 Link to this post

    Yes, I have figured this problem out. I wanted to programatically edit the cells. This is the code inside the datagrid_cellendedit sub routine.

    If DataGridReject.Templates(0).CurrentColumn.HeaderText = "MATERIAL_NO" Then
     
               Dim rejectID = DataGridReject.CurrentRow.Cells(2).Value.ToString
               Dim revision = DataGridReject.CurrentRow.Cells(3).Value.ToString
     
               Dim materialUpdateStr As String = "exec spRR_UPDATEPARTSLISTMATERIAL '" + rejectID + "', '" + revision + "', '" + e.Value.ToString + "'"
     
               conn.Open()
     
               Dim comm = New SqlCommand(materialUpdateStr, conn)
               comm.ExecuteNonQuery()
     
               conn.Close()
     
           End If
Back to Top
UI for WinForms is Visual Studio 2017 Ready