添加图像按钮鼠标悬停事件
我有网络表单,我将图像(图像按钮)添加到表中,该表是在运行时从数据库动态创建的...有一个静态图像,它将根据动态图像鼠标悬停而改变...
这是代码:
HtmlTable tbProductImage = new HtmlTable();
HtmlTableRow trImageRow = new HtmlTableRow();
for (int j = 0; j < columnCount; j++) {
if (filteredFileList.Count != 0) {
HtmlTableCell tdImageRow = new HtmlTableCell();
Panel panel = new Panel();
ImageButton btnProduct = new ImageButton();
btnProduct.ID = "btn" + filteredFileList[j].Name.Substring(0, filteredFileList[j].Name.LastIndexOf("."));
btnProduct.ImageUrl = @"/ysyp/Images/Products/" + filteredFileList[j].Name;
btnProduct.Width = 50;
btnProduct.CommandName = "Click";
Page.ClientScript.GetPostBackEventReference(btnProduct, "btnProduct_Click");
btnProduct.CommandArgument = filteredFileList[j].Name;
btnProduct.Click += new ImageClickEventHandler(btnProduct_Click);
panel.Controls.Add(btnProduct);
trImageRow.Cells.Add(tdImageRow);
tdImageRow.Controls.Add(panel);
}
}
tbProductImage.Rows.Add(trImageRow);
tdProduct.Controls.Add(tbProductImage);
我该怎么办...
谢谢...
i have web form and i added image(imagebutton) into table which is dynamically created in runtime from database... there is a static image and it will changed according to dynamic image(s) mouse over...
here is the code:
HtmlTable tbProductImage = new HtmlTable();
HtmlTableRow trImageRow = new HtmlTableRow();
for (int j = 0; j < columnCount; j++) {
if (filteredFileList.Count != 0) {
HtmlTableCell tdImageRow = new HtmlTableCell();
Panel panel = new Panel();
ImageButton btnProduct = new ImageButton();
btnProduct.ID = "btn" + filteredFileList[j].Name.Substring(0, filteredFileList[j].Name.LastIndexOf("."));
btnProduct.ImageUrl = @"/ysyp/Images/Products/" + filteredFileList[j].Name;
btnProduct.Width = 50;
btnProduct.CommandName = "Click";
Page.ClientScript.GetPostBackEventReference(btnProduct, "btnProduct_Click");
btnProduct.CommandArgument = filteredFileList[j].Name;
btnProduct.Click += new ImageClickEventHandler(btnProduct_Click);
panel.Controls.Add(btnProduct);
trImageRow.Cells.Add(tdImageRow);
tdImageRow.Controls.Add(panel);
}
}
tbProductImage.Rows.Add(trImageRow);
tdProduct.Controls.Add(tbProductImage);
how can i do this...
thank you...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
发布评论
评论(2)
深爱成瘾2024-10-22 01:23:11
如果有人想要格式化代码:
HtmlTable tbProductImage = new HtmlTable();
HtmlTableRow trImageRow = new HtmlTableRow();
for (int j = 0; j < columnCount; j++)
{
if (filteredFileList.Count != 0)
{
HtmlTableCell tdImageRow = new HtmlTableCell();
Panel panel = new Panel();
ImageButton btnProduct = new ImageButton();
btnProduct.ID = "btn" + filteredFileList[j].Name.Substring(0, filteredFileList[j].Name.LastIndexOf("."));
btnProduct.ImageUrl = @"/ysyp/Images/Products/" + filteredFileList[j].Name;
btnProduct.Width = 50;
btnProduct.CommandName = "Click";
Page.ClientScript.GetPostBackEventReference(btnProduct, "btnProduct_Click");
btnProduct.CommandArgument = filteredFileList[j].Name;
btnProduct.Click += new ImageClickEventHandler(btnProduct_Click);
panel.Controls.Add(btnProduct);
trImageRow.Cells.Add(tdImageRow);
tdImageRow.Controls.Add(panel);
}
}
tbProductImage.Rows.Add(trImageRow);
tdProduct.Controls.Add(tbProductImage);
~没有更多了~
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
使用CSS伪选择器悬停。
将类添加到您的 imagebutton:
在 css 中定义 hoverButton 类:
Use CSS pseudo selector hover.
Add class to your imagebutton:
Define hoverButton class in your css: