asp.net wap 2.0 实现 ishtml32 下 加载 css文件
使用asp.net 开发wap 网站,在ishtml32下,如果手机浏览器支持ishtml32,但是 SupportsCss=False 时,想加载css文件时,采用重写mobile:form的方法来实现
using System;
using System.Configuration;
using System.Web.UI.MobileControls;
using System.Web.UI.MobileControls.Adapters;
public class MyForm : Form
{
public string CssPath
{
get
{
if( ViewState["CssPath"] != null)
return (string)ViewState["CssPath"];
else
return string.Empty;
}
set
{
ViewState["CssPath"] = value;
}
}
}
//Now Create the Form Adapter
public class HtmlMyFormAdapter : HtmlFormAdapter
{
protected new MyForm Control
{
get
{
return (MyForm)base.Control;
}
}
protected override bool RenderExtraHeadElements( HtmlMobileTextWriter writer )
{
if( writer != null )
{
if( this.Control.CssPath.Length > 0 )
&n
相关文档:
//获取一个特定元素的样式属性
function getStyle(elem,name){
//如果该属性存在于style中 则他最近被设置过
if(elem.style[name]){
return elem.style[name];
}
//否则尝试IE方法
else if(elem.currentStyle){
return elem.currentStyle[name];
//W3C方法
}else if(document.defaultview && document ......
原来用jQuery的ajax方式调用asp.net页面基本都是调用单个页面,由调用页面Response内容,而现在采用asp.net ajax后,我们则可以更完美的使用jQuery和asp.net结合了,代码如下:
<asp:ScriptManager ID="ScriptManager1" runat="server" >
<Scripts>
<asp:ScriptReference Path="http ......
//default.aspx.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Data.OleDb;
using System.Data.SqlClient;
using System.Runtime.InteropService ......
关于ClientID的使用我遇到一下问题:
获取由 ASP.NET 生成的服务器控件标识符。
问题一: 用户控件的页面JavaScript中需要使用Asp.net的控件ID,出现不一致。
问题二:母版页的子页面JavaScript中需要使用Asp.net的控件ID,出现不一致。
解决办法:
document.getElementById("<% ......
在你的Page_Load中添加这样的代码:
Page.Response.Clear();
bool success = ResponseFile(Page.Request, Page.Response, "目的文件名称", @"源文件路径", 1024000);
if (!success)
Response.Write("下载文件出错!");
Page. ......