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显示对应类的图片
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显示对应类的图片
解决方案 »
- Asp.net使用FreeTextBox.......
- 框架里的子页如何接收从上一页传过来的参数
- asp.net发布后添加服务控件问题
- 能不能根据dropdownlist 显示的文本来定位到指定的那条列表值上
- 我遇到过很多次这样的奇怪问题了,这次又是:select top 8 * from menu4 结果绑定到datalist远远不止8条记录,如果把8把成4则是正确性的
- ~~~~~~~~~~大家学习.Net互相交流来QQ群:201308875~~~~~~~~~
- post是怎么传值的
- 招聘信息 。ASP高级程序员
- MSSQL 中不能为一个列设默认值???
- 请教ASP.NET中用C#语言连数据库
- 用Excel.application 读取excel2007中的全部数据存入数据库中
- 本地可以上传word,但网站发布后就拒绝访问了
右键图片属性,看看路径是不是有问题吧。