从动态添加的图像按钮中删除提交查询

Remove Submit Query From dynamically added Image Button

我正在使用 c# website.in 这个页面之一我需要通过代码端图像按钮动态添加,但它显示提交 query.So,现在我的问题是如何删除这个从动态添加的图片按钮提交查询

我假设你正在做这样的事情来添加 ImageButton :

      ImageButton imageButton = new ImageButton();
      FileInfo fileInfo = new FileInfo(strFileName);
      imageButton.ImageUrl = "~/img/abc.png";
      imageButton.Width = Unit.Pixel(100);
      imageButton.Height = Unit.Pixel(100);

我建议您像这样将 value 属性设置为空字符串 "" :

imageButton.Attributes["value"]="";

imageButton.Attributes.Add("value", "");

也参考这个Whosebug post

希望对您有所帮助!