< telerik:GridEditCommandColumn/> and <telerik:GridButtonColumn> imagebutton hover
2011-11-24 18:33
549 查看
When i change the styles for Telerik, i want the imagebutton used in < telerik:GridEditCommandColumn/> and <telerik:GridButtonColumn> display different image when mouse hover it. i didn't know where is a property that i can set to show an alternative image
when i hover over a GridButtonColumn cotrol item and the ButtonType is set to imageButton. So i find a way from internet:
aspx:
<telerik:RadGrid runat="server" ID="gvData" onitemdatabound="gvData_OnRowDataBound" >
<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="ibtnEdit" EditImageUrl="~/Images/grid_edit.png" ></telerik:GridEditCommandColumn>
<telerik:GridButtonColumn ButtonType="ImageButton" ImageUrl="~/Images/grid_delete.png" UniqueName="ibtnDelete" CommandName="Delete" Text="Delete" ConfirmText="Are you sure you want to delete this record?" ConfirmDialogType="RadWindow" ConfirmTitle="Delete"
/>
</telerik:RadGrid>
C#:
protected void gvData_OnRowDataBound(object source, Telerik.Web.UI.GridItemEventArgs e)
{
if (e.Item is GridDataItem)
{
GridDataItem gditem = (GridDataItem)e.Item;
ImageButton ibtnDelete = (ImageButton)gditem["ibtnDelete"].Controls[0];
ibtnDelete.Attributes.Add("onmouseover", "this.src=\"" + ResolveUrl("~/Images/delete_hover.png") + "\"");
ibtnDelete.Attributes.Add("onmouseout", "this.src=\"" + ResolveUrl("~/Images/delete.png") + "\"");
ImageButton ibtnEdit = (ImageButton)gditem["ibtnEdit"].Controls[0];
ibtnEdit.Attributes.Add("onmouseover", "this.src=\"" + ResolveUrl("~/Images/edit_hover.png") + "\"");
ibtnEdit.Attributes.Add("onmouseout", "this.src=\"" + ResolveUrl("~/Images/edit.png") + "\"");
}
}
it can work.
when i hover over a GridButtonColumn cotrol item and the ButtonType is set to imageButton. So i find a way from internet:
aspx:
<telerik:RadGrid runat="server" ID="gvData" onitemdatabound="gvData_OnRowDataBound" >
<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="ibtnEdit" EditImageUrl="~/Images/grid_edit.png" ></telerik:GridEditCommandColumn>
<telerik:GridButtonColumn ButtonType="ImageButton" ImageUrl="~/Images/grid_delete.png" UniqueName="ibtnDelete" CommandName="Delete" Text="Delete" ConfirmText="Are you sure you want to delete this record?" ConfirmDialogType="RadWindow" ConfirmTitle="Delete"
/>
</telerik:RadGrid>
C#:
protected void gvData_OnRowDataBound(object source, Telerik.Web.UI.GridItemEventArgs e)
{
if (e.Item is GridDataItem)
{
GridDataItem gditem = (GridDataItem)e.Item;
ImageButton ibtnDelete = (ImageButton)gditem["ibtnDelete"].Controls[0];
ibtnDelete.Attributes.Add("onmouseover", "this.src=\"" + ResolveUrl("~/Images/delete_hover.png") + "\"");
ibtnDelete.Attributes.Add("onmouseout", "this.src=\"" + ResolveUrl("~/Images/delete.png") + "\"");
ImageButton ibtnEdit = (ImageButton)gditem["ibtnEdit"].Controls[0];
ibtnEdit.Attributes.Add("onmouseover", "this.src=\"" + ResolveUrl("~/Images/edit_hover.png") + "\"");
ibtnEdit.Attributes.Add("onmouseout", "this.src=\"" + ResolveUrl("~/Images/edit.png") + "\"");
}
}
it can work.
相关文章推荐
- android This tag and its children can be replaced by one <TextView/> and a compound drawable 布局文件提示
- eclipse提示:This tag and its children can be replaced by one <TextView/> and a compound drawable
- This tag and its children can be replaced by one <TextView/> and a compound drawable
- This tag and its children can be replaced by one <TextView/> and a compound drawable
- This tag and its children can be replaced by one <TextView/> and a compound drawable
- This tag and its children can be replaced by one <TextView/> and a compound drawable
- <<High Performance JavaScript>>读书笔记-5.Strings and Regular Expressions
- 如何使用<Beginning ASP.NET 3.5 in C# and VB>书中的示例代码
- The constructor Intent(new View.OnClickListener(){}, Class<ButtonStudyActivity>) is undefined
- java-mysql异常<Data truncation: Data too long for column 'name ' at row 1>讨论
- "-It" 等价于 "<" "-gt" 等价于 ">" "-eq" 等价于 "=" ???
- EF 新增数据时提示it has a DefiningQuery and no <InsertFunction> element exists in the <ModificationFunctionMapping> element
- IT成长路<2013.3-2013.9>"而立"上篇
- android <viewStub />, <requestFocus />, <merge /> and <include />用法
- miniui <div type="checkcolumn"></div>的事件
- <command-line>:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]
- logback logback.xml常用配置详解(一)<configuration> and <logger>
- <LeetCode OJ> 105. Construct Binary Tree from Preorder and Inorder Traversal
- <button>与<input type="button">在火狐下区别 ajax请求
- [Script]Get APPL_TOP and <PROD>_TOP