This is a migrated thread and some comments may be shown as answers.

[Solved] How to Restrict of Assigning Onclick event script in Autogenerated Columns grid

1 Answer 120 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Medac
Top achievements
Rank 1
Medac asked on 17 Jul 2009, 06:50 AM
Hi,

I have added cell click event for the radgrid as below under ItemDatabound event of the grid.

If

 

TypeOf e.Item Is GridDataItem Then

 

 

    For Each col As GridColumn In radgrdClaimsName.MasterTableView.RenderColumns

 

 

        Dim dataItem As GridDataItem = DirectCast(e.Item, GridDataItem)

 

        dataItem(col.UniqueName).Attributes.Add(

"onclick", ("RowSelectedCarrierName('" & dataItem.ItemIndex & "','" & col.OrderIndex & "');"))

 

 

    Next

 

 

End If

I have Totals as my grid's last column. I want to restrict the user by clicking on this particular column i.e Totals column.
What should I modify in my above code so that I can restrict the user by selecting the cell of Total column?

Thanks in advance,
Medac

 

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 17 Jul 2009, 07:43 AM
Hello Medac,

You can try out the following code to restrict the Totals column's cells from being clicked:

vb:
If TypeOf e.Item Is GridDataItem Then 
    For Each col As GridColumn In radgrdClaimsName.MasterTableView.RenderColumns 
 
        Dim dataItem As GridDataItem = DirectCast(e.Item, GridDataItem) 
          If col.UniqueName <> "Country" Then 
            dataItem(col.UniqueName).Attributes.Add("onclick", ("RowSelectedCarrierName('" & dataItem.ItemIndex & "','" & col.OrderIndex & "');"))  
         
          End If       
      Next 
End If 

Thanks
Princy.
Tags
Grid
Asked by
Medac
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or