Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 94857

Command Column Click Event

$
0
0

This will do what I *think* you are asking for, just a sample but should point the way:

Private Sub Form1_Load( sender As Object,  e As EventArgs) Handles MyBase.Load
    
       'create a command column (button)
       Dim commandColumn As New GridViewCommandColumn()
       'name it so we cah check forit later
       commandColumn.Name = "change"
       commandColumn.UseDefaultText = False
       commandColumn.HeaderText = "Command"
       'add the button
       RadGridView1.MasterTemplate.Columns.Add(commandColumn)
       'add a column to hold price info
       Dim priceColumn As New GridViewTextBoxColumn()
       priceColumn.Name = "price"
       priceColumn.HeaderText = "Price"
       RadGridView1.MasterTemplate.Columns.Add(priceColumn)
       'Adds three rows of data to the grid
       radgridview1.rows.add("Add","10")
       radgridview1.rows.add("Add","13")
       radgridview1.rows.add("Add","15")
 
 
   End Sub

 then in the events of the grid box choose the CellClick event and put something like this:

Private Sub RadGridView1_CellClick( sender As Object,  e As GridViewCellEventArgs) Handles RadGridView1.CellClick
        'everytime a cell isclicked thiswill run, check to see ifthey clicked the column named change
        ife.Column.name = "change"
            'ifso then take the current row and replace the value with whatever istyped inthe textbox1
            RadGridView1.mastertemplate.currentrow.cells("price").value = textbox1.text
 
        End If
End Sub

 

Let me know if you need clarification.

Joe

 


Viewing all articles
Browse latest Browse all 94857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>