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

gridbutton colum- Image not dsplayed

3 Answers 35 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Newbie
Top achievements
Rank 1
Newbie asked on 06 Sep 2012, 07:05 PM
<telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" ConfirmText=""
  ConfirmTitle="" ConfirmDialogType="RadWindow" UniqueName="delete_notification" 
    ImageUrl="Images/DeleteRedResized.png" ShowSortIcon="false" SortExpression="">
   <HeaderStyle HorizontalAlign="Center" VerticalAlign="Top" Width="4%" />
      <ItemStyle HorizontalAlign="Center" VerticalAlign="Top" Width="4%" />
        </telerik:GridButtonColumn>

I have a grid button column in my grid. I have delete button in this. My Image for the delete button is not displayed for some reason. cant figure put why. i have set enable theamiing to false.

I am attaching the screenshot.

thankyou

3 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 07 Sep 2012, 08:09 AM
Hello,

Please try with below code snippet.

<telerik:GridButtonColumn CommandName="Deletenotification" ButtonType="ImageButton" ImageUrl="~/images/jayesh-Softweb.jpg"
                       UniqueName="delete_notification">
                   </telerik:GridButtonColumn>
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
    {
        if (e.CommandName == "Deletenotification")
        {
             // perform your action
 
            RadGrid1.Rebind();
        }
    }

Note : you are not able to see your assigned image because you have set inbuilt Delete command, so it displayed its default delete image.

Thanks,
Jayesh Goyani
0
Newbie
Top achievements
Rank 1
answered on 07 Sep 2012, 01:15 PM
Thanks for you reply Jayesh, But I am not very clear where to include the code snippet. I am pasting my code behind for delete. i appreciate your help.
Private Sub NotifyGrid_DeleteCommand(sender As Object, e As Telerik.Web.UI.GridCommandEventArgs) Handles NotifyGrid.DeleteCommand
    
    Dim iRet As Integer
    Dim strSql As String = "gsp_wp_MyNotifications_DeleteNotification"
    Dim sqlParam() As SqlParameter = New SqlParameter(2) {}
      
    Try
        Dim item As GridDataItem = DirectCast(e.Item, GridDataItem)
        Dim iSignupId As Integer = Convert.ToInt32(item.Cells.Item(12).Text.ToString)
        sqlParam(0) = New SqlParameter("@UserName", SqlDbType.Int)
        sqlParam(0).Value = Convert.ToInt32(Session("username"))
        sqlParam(1) = New SqlParameter("@SignUpID", SqlDbType.Int)
        sqlParam(1).Value = iSignupId
        iRet = SqlHelper.ExecuteScalar(AppSettings("conALSQL"), CommandType.StoredProcedure, strSql, sqlParam)
        'RadNotification1.Title = GetLocalResourceObject("DeleteNofityStatusTitle").ToString
        'RadNotification1.Text = GetLocalResourceObject("DeleteNofityConfirmMsg").ToString
        'RadNotification1.Show()
        Session("NotificationDeleted") = 1
        'Response.Redirect("NG_MyNotifications.aspx")
        'ScriptManager1.RegisterClientScriptBlock(Me.GetType, "refresh", "<script type='text/javascript'>SaveAndRebind()</" + "script>")
        ScriptManager.RegisterClientScriptBlock(Me, Me.GetType, "refresh", "window.__doPostBack('', '__REFRESH')", True)
    Catch ex As Exception
        WebPartUtil.LogError("Error Deleting the notification, exception was: " & ex.Message.ToString)
        Me.RadNotification6.Show()
    End Try
End Sub

Thanx
0
Jayesh Goyani
Top achievements
Rank 2
answered on 07 Sep 2012, 06:32 PM
Hello,

Please try with below code snippet.

Protected Sub RadGrid1_ItemCommand(sender As Object, e As GridCommandEventArgs)
    If e.CommandName = "Deletenotification" Then
        ' perform your action
  
Dim iRet As Integer
    Dim strSql As String = "gsp_wp_MyNotifications_DeleteNotification"
    Dim sqlParam() As SqlParameter = New SqlParameter(2) {}
       
    Try
        Dim item As GridDataItem = DirectCast(e.Item, GridDataItem)
        Dim iSignupId As Integer = Convert.ToInt32(item.Cells.Item(12).Text.ToString)
        sqlParam(0) = New SqlParameter("@UserName", SqlDbType.Int)
        sqlParam(0).Value = Convert.ToInt32(Session("username"))
        sqlParam(1) = New SqlParameter("@SignUpID", SqlDbType.Int)
        sqlParam(1).Value = iSignupId
        iRet = SqlHelper.ExecuteScalar(AppSettings("conALSQL"), CommandType.StoredProcedure, strSql, sqlParam)
        'RadNotification1.Title = GetLocalResourceObject("DeleteNofityStatusTitle").ToString
        'RadNotification1.Text = GetLocalResourceObject("DeleteNofityConfirmMsg").ToString
        'RadNotification1.Show()
        Session("NotificationDeleted") = 1
        'Response.Redirect("NG_MyNotifications.aspx")
        'ScriptManager1.RegisterClientScriptBlock(Me.GetType, "refresh", "<script type='text/javascript'>SaveAndRebind()</" + "script>")
        ScriptManager.RegisterClientScriptBlock(Me, Me.GetType, "refresh", "window.__doPostBack('', '__REFRESH')", True)
    Catch ex As Exception
        WebPartUtil.LogError("Error Deleting the notification, exception was: " & ex.Message.ToString)
        Me.RadNotification6.Show()
    End Try
 
         
    End If
End Sub


Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Newbie
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Newbie
Top achievements
Rank 1
Share this question
or