| 燕君 的个人资料White And Blue照片日志列表 | 帮助 |
|
|
1月6日 multiview控件 multiview控件,实际上是有点象在c/s开发中很常见的tabcontrol控件,可以在一个页面中,放置多个"view"(我们称为选项卡),比如可以用multiview控件,可以让用户在同一页面中,通过切换到每个选项卡,从而看到要看的内容,而不用每次都重新打开一个新的窗口。 然而对Panel 的 Visible属性进行控制也可以完成这个工作,只是说用这个更专业吧! 未选择某个 View 控件时,该控件不会呈现到页面中。但是,每次呈现页面时都会创建所有 View 控件中的所有 Web 服务器控件的实例,并且将这些实例的值存储为页面的视图状态的一部分。 通过将 MultiView 控件的 ActiveViewIndex 属性设置为要显示的 View 控件的索引值,可以在视图间移动。MultiView 控件还支持可以添加到每个 View 控件的导航按钮。 若要创建导航按钮,可以向每个 View 控件添加一个按钮控件(Button、LinkButton或 ImageButton )。然后可以将每个按钮的 CommandName 和 CommandArgument 属性设置为保留值以使 MultiView 控件移动到另一个视图。下表列出了保留的 CommandName 值和相应的 CommandArgument 值。
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="MultiView.aspx.vb" Inherits="MultiView" %>![]() <!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> </head> <body> <form id="form1" runat="server"> <div> <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"> <asp:ListItem Value="0">view1</asp:ListItem> <asp:ListItem Value="1">view2</asp:ListItem> <asp:ListItem Value="2">view3</asp:ListItem> </asp:DropDownList> <br> <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0"> <asp:View ID="View1" runat="server"> 111111111111111111111111111<br /> <asp:Button ID="Button1" runat="server" CommandName="NextView" Text="next" /> <asp:Button ID="Button5" runat="server" CommandArgument="View3" CommandName="SwitchViewByID" Text="last" /></asp:View> <asp:View ID="View2" runat="server"> 222222222222222222222222222<br /> <asp:Button ID="Button2" runat="server" CommandName="PrevView" Text="pre" /> <asp:Button ID="Button3" runat="server" CommandName="NextView" Text="next" /></asp:View> <asp:View ID="View3" runat="server"> 333333333333333333333333333<br /> <asp:Button ID="Button4" runat="server" CommandArgument="0" CommandName="SwitchViewByIndex" Text="first" /> <asp:Button ID="Button6" runat="server" CommandName="preview" Text="pre" /></asp:View> </asp:MultiView></div> </form> </body> </html>![]() Partial Class MultiView Inherits System.Web.UI.Page![]() Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Request.QueryString("id") <> "" Then MultiView1.ActiveViewIndex = Convert.ToInt32(Request.QueryString("id")) End If End Sub![]() Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged MultiView1.ActiveViewIndex = Convert.ToInt32(DropDownList1.SelectedValue) End Sub End ClassvisualStudio2005设计视图打不开gdiplus.dll 保证在
8月20日 textarea格式设置说明:
一般textarea提交到数据库,直接在显示有些换行等格式会丢失。
为了解决这个问题,输出的时候不妨也用textarea,但是必须使textarea的显示格式如一般输出
参数设置如下:
<textarea name="textarea" cols="90" readonly wrap="PHYSICAL" style="border: none;overflow: visible;height: auto;"><%=rs("NewsContent")%></textarea> 8月12日 把所有的textbox值为空//和空灵共同进步
//把所有的textbox值为空
//this.Controls是所有的控件的集合,方法2中直接第1次获得的是Control的集合,第二次才是textbox对象 ,方法1中则去第1个集 // 方法1
foreach( Control rc in this.Controls[1].Controls )
{ if(rc is TextBox) ((TextBox)rc).Text=""; } //
方法2:
foreach(Control rc in this.Controls) { if(rc is TextBox) ((TextBox)rc).Text=""; else foreach(Control sc in rc.Controls) if(sc is TextBox) ((TextBox)sc).Text=""; } 8月11日 这个方法更简单好懂csdn上 cityhunter172(寒羽枫) 提供
在 Page_Load 中
if(!IsPostBack) { this.TextBox1.Attributes["onkeydown"]="clickBtn('Button1')"; this.TextBox2.Attributes["onkeydown"]="clickBtn('Button2')"; } 在页面中加入脚本
<script language=javascript> <!-- function clickBtn(id) { var btn = document.getElementById(id); //根据 ID 找到 Button if(btn== null){return;} //没找到,则返回 if (event.keyCode ==13 ) //按下的是回车键 { btn.click(); event.returnValue = false; //阻止回车键的生效 } } //--> </script> |
|
|