Click here to Skip to main content
15,943,294 members
Please Sign up or sign in to vote.
5.00/5 (2 votes)
See more:
hi
Here i wrote the code like this

VB
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
       GoalGrid()
       ParticipantGrid()
   End Sub


VB
Public Sub GoalGrid()
        AddHandler grdGoalLevel.NeedDataSource, AddressOf grdGoalLevel_NeedDataSource
        AddHandler grdGoalLevel.ItemCreated, AddressOf grdParticipants_ItemCreated
        AddHandler grdGoalLevel.ItemCommand, AddressOf grdParticipants_ItemCommand
        AddHandler grdGoalLevel.UpdateCommand, AddressOf grdParcipants_UpdateCommand
        Dim index As Integer = 0
        grdGoalLevel.MasterTableView.EditMode = GridEditMode.InPlace

        Dim editColumn As New GridEditCommandColumn
        editColumn.ButtonType = GridButtonColumnType.ImageButton
        editColumn.EditImageUrl = "~/Assets/image/core/note_btn.png"
        editColumn.UpdateImageUrl = "~/Assets/image/core/tick_ic.png"
        editColumn.CancelImageUrl = "~/Assets/image/core/cancel_btn.png"


grdGoalLevel.MasterTableView.Columns.AddAt(index, editColumn)

my problum is here EditImageUrl,UpdateEmageUrl, CancelImageUrl are directly given the image references, but here i want to add spriteImages by calling the cssClasses.
i dont want to
VB
editColumn.EditImageUrl = "~/Assets/image/core/note_btn.png"
like this
i want to call css class insted of "~/Assets/image/core/note_btn.png"

so ,please help me anyone.

here i had tried for edit button like this


VB
Dim editColumn As New GridEditCommandColumn
editColumn.ButtonType = GridButtonColumnType.LinkButton
editColumn.ItemStyle.CssClass = "buttonEdit1"


in the same way i have to add for updateImageurl and cancelImageUrl.
Posted
Updated 27-Dec-11 21:29pm
v3
Comments
Sunasara Imdadhusen 28-Dec-11 1:21am    
Good question. my vote of 5

1 solution

Hi You can add CSS Class of CommandField using following method

Static

ASP.NET
<asp:commandfield showselectbutton="True" itemstyle-cssclass="cssSelect">
</asp:commandfield>

OR
ASP.NET
<asp:commandfield showselectbutton="True" >
<controlstyle cssclass="cssSelect" />
</asp:commandfield>


Dynamic

C#
CommandField cf = new CommandField();
cf.ItemStyle.CssClass = "cssSelect";

OR
C#
cf.ControlStyle.CssClass = "cssSelect";


StyleSheet

You can set following style if you set ItemStyle-CssClass
CSS
td.cssSelect a
{
    color:Red;
}


You can set following style if you set ControlStyle CssClass
CSS
a.cssSelect
{
    color:Red;
}

Please do let me know, if you have still problem.
 
Share this answer
 
v3
Comments
Member 8362403 28-Dec-11 3:26am    
thanks, i think you are not understand my question.in the above question i have to add css class , here i tried


Dim editColumn As New GridEditCommandColumn
editColumn.ButtonType = GridButtonColumnType.LinkButton
editColumn.ItemStyle.CssClass = "buttonEdit1"

here i got the edit button, in the same way i want to add update button and cancel button,

when we click the edit button , it shows update and cancel buttons ,

so how to add update and cancel buttons.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900