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

What the Promethus Grid version of this?

3 Answers 51 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David Penny
Top achievements
Rank 2
David Penny asked on 01 Feb 2008, 02:53 PM

Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemCreated  
        If (TypeOf e.Item Is GridEditItem) Then  
            Dim item As GridDataItem = CType(e.Item, GridEditItem)  
            Dim intUniqueID As Integer = e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("ID")  
            Dim linkButton As LinkButton = CType(item("EditColumn").Controls(0), LinkButton)  
            Dim a As System.Web.UI.HtmlControls.HtmlAnchor = New HtmlAnchor  
            Dim js As StringString = String.Format("return ShowEditForm('{0}');", intUniqueID)  
            a.InnerHtml = linkButton.Text  
            a.Attributes("href") = ""  
            a.Attributes("onclick") = js  
            item("EditColumn").Controls.Remove(linkButton)  
            item("EditColumn").Controls.Add(a)  
        End If  
    End Sub 
Hopefully a really simple question.  I am trying to implement the above in Prometheus Grid but it objects to the line 
If (TypeOf e.Item Is GridEditItem) Then  
saying e.item cannot be of type GridEditItem.

What's the equivilant in Prometheus Grid?

David Penny

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 01 Feb 2008, 04:11 PM
Hi David,

I think this should be GridEditableItem - there is no GridEditItem class in both classic and "Prometheus" grid.

Kind regards,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
David Penny
Top achievements
Rank 2
answered on 02 Feb 2008, 04:10 PM
Thanks Vlad,

I think I may have pasted the wrong bit of code in.  It shold have read:
Private Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemCreated  
 
If (TypeOf e.Item Is GridDataItem) Then  
 
Dim item As GridDataItem = CType(e.Item, GridDataItem)  
 
Dim intUniqueID As Integer = e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("UniqueID")  
 
Dim linkButton As LinkButton = CType(item("EditColumn").Controls(0), LinkButton)  
 
Dim a As System.Web.UI.HtmlControls.HtmlAnchor = New HtmlAnchor  
 
Dim js As StringString = String.Format("return ShowEditForm('{0}');", intUniqueID)  
 
a.InnerHtml = linkButton.Text  
 
a.Attributes("href") = ""  
 
a.Attributes("onclick") = js  
 
item("EditColumn").Controls.Remove(linkButton)  
 
item("EditColumn").Controls.Add(a)  
 
End If  
 
End Sub  
 

This works for me in RadControls 2007 Q2 RadGrid.  When I try the same code using Rad Prometheus Q3 2008 I get the message that e.Item cannot be of type GridDataItem.

I generally use RadWindow to edit RadGrid Items, which is where this code is used, and am trying to do the same with RadGrid Prometheus.

David Penny

0
David Penny
Top achievements
Rank 2
answered on 03 Feb 2008, 10:30 AM
Vlad,

Just ignore me!

I am so used to putting Imports Telerik.WebControls onto a page that I had both that and Imports telerik.Web.UI - obviously it does not like this...  All OK now.

David Penny
Tags
Grid
Asked by
David Penny
Top achievements
Rank 2
Answers by
Vlad
Telerik team
David Penny
Top achievements
Rank 2
Share this question
or