Welcome Guest Search | Active Topics | Sign In | Register

EO DataGrid and Adding a Hyperlink/Imagbutton to a custom column Options
Darrell Reinke
Posted: Friday, August 15, 2008 2:17:53 PM
Rank: Advanced Member
Groups: Member

Joined: 7/18/2008
Posts: 76
Is it possible to add a hyplink or imagebutton to a custom column within your EO Grid Object?

I would like to provide the same functionality with your grid object that a regular .NET grid object provides.

Example: I have a regular .NET grid object with an ImageButton added within a column in the grid and on the server side in the ItemDataBound event I can add javascript to the control as shown below.

Code: Visual Basic.NET
Private Sub dgrdCritDates_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgrdCritDates.ItemDataBound

      Dim myControl As Control = e.Item.FindControl("ImgDelete")

      Try
         If Not IsNothing(myControl) Then
            Dim js As String
            js = "return confirm('Do you really want to delete the record?  THIS IS NOT RECOMENDED!!!');"
            CType(e.Item.FindControl("ImgDelete"), ImageButton).Attributes("OnClick") = js
         End If
      Catch exControl As Exception
         Session("ERROR") = "Control Find Errors::  " + exControl.Message.Trim
         Session("DTLERROR") = exControl.ToString.Trim
         Response.Redirect("EDWErrorPage.aspx")
      End Try


I can't seem to even declare an image button object within your custom column, the only options I get are for your checkbox, button, editmask, etc.

If I am unclear, please let me know and I will provide more detail.

Thank you,

Darrell
eo_support
Posted: Friday, August 15, 2008 2:33:41 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,193
Hi,

You can implement pretty much anything with CustomColumn but it works very differently. ASP.NET Grid works on server controls, where as our Grid mostly works on client side DHTML and JavaScript. This is necessary because unlike ASP.NET Grid which goes back to the server every time, our Grid only goes back to the server when necessary, for example, to submit the changes. Since most actions are done on the client side, it requires you to focus on client side programming instead of server side programming.

In your case, you may want to base your code on this sample:

http://www.essentialobjects.com/Demo/Default.aspx?path=Grid\_i1\_i9

You would change the DeleteCommandColumn's DeleteText property to some HTML code such as "<img src='your_image_url' />" --- Keep in mind that you need to use plain HTML, no ImageButton here.

Thanks
Darrell Reinke
Posted: Monday, August 18, 2008 6:13:59 AM
Rank: Advanced Member
Groups: Member

Joined: 7/18/2008
Posts: 76
Thank you. Will do.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.