Rad Gridview get cell value, delete row and restrict duplicate values in textbox

1 Answer 119 Views
GridView
Aravind
Top achievements
Rank 2
Iron
Iron
Iron
Aravind asked on 12 Jun 2023, 06:56 AM | edited on 13 Jun 2023, 03:35 AM
Hi,
    I have successfully added three controls in radgridview, Textbox,Combobox and button in winform page load.
Here the code i used.
        Dim grdTextBox As New GridViewTextBoxColumn
        grdTextBox.Width = 140
        grdTextBox.FieldName = "Index Name"
        RadGridView1.Columns.Add(grdTextBox)


        Dim comboColumn As New GridViewComboBoxColumn("Type")
        comboColumn.DataSource = New [String]() {"Text", "Number", "Deciaml", "Notes", "Date", "Option"}
        comboColumn.FieldName = "Type"
        comboColumn.Width = 200
        RadGridView1.Columns.Add(comboColumn)
      

        Dim btn As New GridViewCommandColumn
        btn.Image = My.Resources.close
        btn.Width = 25
        RadGridView1.Columns.Add(btn)
After i click and add values inside gird view,  i want to manipulate values in grid view like check duplicate value, remove row and get values for store in database.

1.How to restrict duplicate entry in textbox ?
2.How to delete row using button ?
3.Is it possible to add running number which is not visible in interface and used for delete row. ? 


Pls replay asap in vb language.

Regards
Aravind 

1 Answer, 1 is accepted

Sort by
1
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 14 Jun 2023, 04:18 PM

Hi, Aravind,

I will go straight to your questions:

1. RadGridView offers a good API for validating the users input in data cells via the CellValidating event. More information on this topic is available here: 

https://docs.telerik.com/devtools/winforms/controls/gridview/editors/data-validation 

regarding the new row, it is appropriate to do the custom checks in the UserAddingRow event:

https://docs.telerik.com/devtools/winforms/controls/gridview/rows/new-row#user-events 

2. In order to remove rows from the grid you can use the Rows.Remove method: https://docs.telerik.com/devtools/winforms/controls/gridview/rows/removing-rows 

3. I am not sure what is the exact goal you are trying to achieve here. Could you please elaborate? Do you mean row numbers? If yes, there is a sample code snippet here on this topic: 

https://docs.telerik.com/devtools/winforms/controls/gridview/cells/formating-examples/row-numbers 

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
GridView
Asked by
Aravind
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or