前台js调用后台函数返回值赋给前台控制属性值

后台cs:
protected string GetPathH()
        {
           
            string path = "";
            if (ds.Tables[0].Columns[11].ToString() == null)
            {
                path = FilePath02 + "/" + "Module/Admin/UpFile/def_exp01.gif";
            }
            else
            {
               path = FilePath02 + "/" + ds.Tables[0].Rows[0]["logo"].ToString();

            }
            return path;
        }

前台js:
<script language="javascript" type="text/javascript">
    function getPathQ()
    {
        var path='<%=GetPathH() %>';
//        alert(path);
//调试所用
        return path;
       
    }
</script>

前台控件调用:
 <asp:Image ID="image01" runat="server" AlternateText="imagelost" style="width:100px;height:60px;" ImageUrl="javascript:getPathQ()"/>

posted @ 2008-07-10 13:55  青菜  阅读(1743)  评论(0)    收藏  举报