单选按钮列表与图像回传丢XXS错误 [英] RadioButtonList with image throwing XXS error on postback

查看:114
本文介绍了单选按钮列表与图像回传丢XXS错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设法通过以下code将图像添加到一个单选按钮

I have managed to add an image to a radio button by the following code

themeRadioButtonList.Items.Add(
    new ListItem(String.Format("<img src='ThemeImages/blue.png'>","fsd")));
themeRadioButtonList.Items.Add(
    new ListItem(String.Format("<img src='ThemeImages/green.png'>")));
themeRadioButtonList.Items.Add(
    new ListItem(String.Format("<img src='ThemeImages/red.png'>")));

正常工作。然而,由于在html给出的横端脚本警报。无论如何解决此问题?

works fine. However due to the html gives a cross side scripting alert. Anyway around this?

推荐答案

您可以试试:

themeRadioButtonList.Items.Add(
    new ListItem(String.Format("<img src='{0}'>", "ThemeImages/blue.png") ,"fsd"));

themeRadioButtonList.Items.Add(
    new ListItem(String.Format("<img src='{0}'>", "ThemeImages/green.png") ));

themeRadioButtonList.Items.Add(
    new ListItem(String.Format("<img src='{0}'>", "ThemeImages/red.png") ));

这篇关于单选按钮列表与图像回传丢XXS错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆