protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "javascript:currentcolor=this.style.backgroundColor;this.style.backgroundColor='#6699f';");
e.Row.Attributes.Add("onmouseout", "javascript:this.style.backgroundColor=currentcolor;");
}
}
......
ASP.NET MVC是继ASP.NET WebForms之后,微软推出的Front Controller式的Web开发模型,它弥补了前者对HTML控制能力不足,单元测试较为困难等缺点。更重要的是,ASP.NET MVC基于MS-PL发布,是一个真正的开源框架——且没有任何平台限制,也就是说,您可以在mono下使用或开发ASP.NET MVC的相关项目。 微软在今年3月的MIX大会上发布ASP.NET MVC RTM的时候,就已经公布了部分ASP.NET MVC 2的计划,并且在官方代码源中包含的MvcFutures项目中实现了V2的部分功能雏形。在沉寂了4个多月之后,10月初微软 发布了ASP.NET MVC 2的Preview 1版本,并在论坛中向社区征求反馈意见和建议。令人放心的是,ASP.NET MVC 2 Preview 1能够与ASP.NET MVC 1.0 RTM共存,不会影响后者的正常使用。12月16日微软又发布了ASP.NET MVC 2 RC,进行了小的更新: IIS script mapping script is no longer available in the installer The IIS script mapping script is a command-line script that is used to configure script maps for IIS 6 and for IIS 7 in Classic mode. The script-mapping script is not needed if you use the Visual Studio Development Server or if you use IIS 7 ......
下面是用来测试验证码的前台显示代码:其中脚本函数change的作用是实现“看不清楚,换一张的效果”
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CheckTest.aspx.cs" Inherits="SecurityCodeTest.CheckTest" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
<mce:script type="text/javascript" ><!--
function Change() {
var d = document.getElementById("image1");
d.src = d.src + '?';
}
// --></mce:script>
</head>
<body>
<form id="form1" runat="server">
<img src="MyCode.aspx" mce_src="MyCode.aspx" id="image1" /><asp:LinkButton ID="link1" runat="server" Text="看不清,换一张" OnClientClick="Change()"></asp:LinkButton>
<div><br />
<asp:TextBox I ......
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("/*\n------输出结果------------");
getSplit("ABCDEFG");
Console.WriteLine("*/");
/*
------输出结果------------
AB
AC
AD
AE
AF
AG
BC
BD
BE
BF
BG
CD
CE
CF
CG
DE
DF
DG
EF
EG
FG
ABC
ABD
ABE
ABF
ABG
BCD
BCE
BCF
BCG
CDE
CDF
CDG
DEF
DEG
EFG
......
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("/*\n------输出结果------------");
getSplit("ABCDEFG");
Console.WriteLine("*/");
/*
------输出结果------------
AB
AC
AD
AE
AF
AG
BC
BD
BE
BF
BG
CD
CE
CF
CG
DE
DF
DG
EF
EG
FG
ABC
ABD
ABE
ABF
ABG
BCD
BCE
BCF
BCG
CDE
CDF
CDG
DEF
DEG
EFG
......
代码:
/// <summary>
/// 打开Excel文件
/// </summary>
/// <param name="ExcelFileName">文件名</param>
private void OpenExcelFile(string ExcelFileName)
{
Excel.Application App = new Excel.Application();
if (App == null)
{
return; //Excel尚未安装
}
Excel.Workbook workbook = App.Workbooks.Open(@ExcelFileName,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type. ......
后台给控件添加js方法
this.btnOK.Attributes["onclick"] = "javascript:return confirm(\"确定保存?\");";
或者
<mce:script type="text/javascript"><!--
function shijian()
{
return confirm(\"确定保存?\");
}
// --></mce:script>
this.btnOK.Attributes["onclick"] = "return shijian()";
设置textbox不可用
asp.net中设置textbox不可编辑用 ReadOnly="True"属性来设置时,
用textbox1.Text.Trim()可能会取不到值,个中原因还不清楚,但可以用Request.Form["textbox1"].ToString()取值
若使用contenteditable="false"来设置不可编辑,这样textbox1.Text.Trim()就可以取到了 ......