大家帮我看看图片显示不出来
C#
this.Dropyp.Attributes.Add("onclick", "yp();");
---
[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.Read)]
public DataTable selectmuster(int imgesid)
{
try
{
SqlCommand mycmd = dbobj.Getcommandpro("pro_selectmuster");
SqlParameter muid = new SqlParameter("@muid", SqlDbType.Int);
muid.Value = imgesid;
mycmd.Parameters.Add(muid);
dbobj.ExecNonQuery(mycmd);
DataTable ad = dbobj.GetDataSet(mycmd);
return ad;
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
}
HTML
<script type="text/javascript">
function yp()
{
var muid=document.getElementById("Dropyp");
AjaxMethod.selectmuster(muid.value,get_muimges);
}
function get_muimges(response)
{
if(response.value != null)
{
var ds = response.value;
if(ds != null && typeof(ds) == "object" && ds.Tables != null)
{
for(var i=0; i<ds.Tables[0].Rows.length; i++)
{
var name=ds.Tables[0].Rows[i].muimges;//从数据库获取图片名称
document.getElementById("<%=Image1.ClientID% >").src="pic/"+name;
}
}
}
return
}
图片不会显示 请教大家我错那了应该如何实现 谢谢!我是选者DropDownList显示对应类的图片