当前位置:首页
开发技术指南» 文章正文
    引言:
 

 

    摘要: datagrid绑定datetime类型时,好像只能显示yyyy-mm-dd hh:mm:ss ,如果我想显示完整的时间数据如:yyyy-mm-dd hh:mm:ss.xxx 请问应该怎么设置? 谢谢! ......
    摘要: 朋友不懂,把windows2000的用户给删除了,现在进不了系统,请问有什么办法可以解决? ......


高难度参数传递问题,还是没有解决

 
  <html>  
  <head>  
   
          <script   language="VB"   runat="server">  
   
            public   Sub   Page_Load(Sender   As   Object,e   As   EventArgs)            
                    Dim   scriptString   As   String     =   "<script   language=JavaScript>   function   DoClick(n)   {"  
                    scriptString   +=   "alert(n);"  
                    scriptString   +=   "span1.innerHTML=Item   +n;"  
                    scriptString   +=   "document.all(""DropDown1"").value   =   document.all(""span1"").innerText;"  
                    scriptString   +=   "alert(span1.innerHTML);}<"  
                    scriptString   +=   "/"  
                    scriptString   +=   "script>"  
   
                            If(Not   Me.IsStartupScriptRegistered("Startup"))   Then  
                                  Me.RegisterStartupScript("Startup",   scriptString)  
                            End   If  
    Bind()  
          End   Sub  
   
   
                  Sub   SubmitBtn_Click(sender   As   Object,   e   As   EventArgs)  
                          Label1.Text="You   chose:   "   +   DropDown1.SelectedItem.Text  
                  End   Sub  
  Sub   Bind()  
                          Response.Write(DropDown1.SelectedItem.Text)  
  End   Sub  
  Sub   OnIDChanged(sender   As   Object,   e   As   EventArgs)  
                          Response.Write(DropDown1.SelectedItem.Text)  
  End   Sub  
   
          </script>  
   
  </head>  
  <body>  
   
          <h3><font   face="Verdana">DropDownList   Example</font></h3>  
  <input   type="text"   id="txt"   value="0"   runat="server"/>  
          <form   runat=server>  
   
                  <asp:DropDownList   id=DropDown1   runat="server"   AutoPostBack   ="True"   OnSelectedIndexChanged="OnIDChanged">  
                          <asp:ListItem>Item   1</asp:ListItem>  
                          <asp:ListItem>Item   2</asp:ListItem>  
                          <asp:ListItem>Item   3</asp:ListItem>  
                          <asp:ListItem>Item   4</asp:ListItem>  
                          <asp:ListItem>Item   5</asp:ListItem>  
                          <asp:ListItem>Item   6</asp:ListItem>  
                  </asp:DropDownList>  
   
                  <asp:button   text="Submit"   OnClick="SubmitBtn_Click"   runat=server/>  
   
                  <p>  
                   
                  <asp:Label   id=Label1   font-name="Verdana"   font-size="10pt"   runat="server">  
                      Select   a   value   from   the   list  
                  </asp:Label>  
                  <br>  
  <%  
  dim   i  
  for   i=1   to   6%>  
                  <input   type="button"   value="Item   <%=i%>"   onclick="DoClick(<%=i%>)">  
  <%next%>  
                  <br>  
                  <span   id="span1"   runat="server">0</span>  
   
          </form>  
   
  </body>  
  </html>  
  上面的程序怎样才能作到点击button   将<span>上的值传给dropdownlist的SelectedIndex,现在<span>可以正确显示值,但是不能传给dropdownlist的SelectedIndex,可以用js传value值,但是SelectedIndexChanged事件用不了,   为什么  
   
   
 

NO.1   作者: Goldsunline

Test   it:  
   
  <html>  
  <head>  
  <script   language="VB"   runat="server">  
   
            public   Sub   Page_Load(Sender   As   Object,e   As   EventArgs)            
                    Dim   scriptString   As   String     =   "<script   language=JavaScript>   function   DoClick(n)   {"  
                    scriptString   +=   "alert(n);"  
                    scriptString   +=   "span1.innerHTML=Item   +n;"  
                    scriptString   +=   "document.all(""DropDown1"").value   =   document.all(""span1"").innerText;"  
                    scriptString   +=   "alert(span1.innerHTML);}<"  
                    scriptString   +=   "/"  
                    scriptString   +=   "script>"  
   
                            If(Not   Me.IsStartupScriptRegistered("Startup"))   Then  
                                  Me.RegisterStartupScript("Startup",   scriptString)  
                            End   If  
                            if   not   me.ispostback()   then  
    Bind()  
    end   if  
          End   Sub  
   
   
                  Sub   SubmitBtn_Click(sender   As   Object,   e   As   EventArgs)  
                          Label1.Text="You   chose:   "   +   DropDown1.SelectedItem.Text  
                  End   Sub  
  Sub   Bind()  
                          Response.Write(DropDown1.SelectedItem.Text)  
  End   Sub  
  Sub   OnIDChanged(sender   As   Object,   e   As   EventArgs)  
                          Response.Write(DropDown1.SelectedItem.Text)  
  End   Sub  
   
  </script>  
  </head>  
  <body>  
  <h3><font   face="Verdana">DropDownList   Example</font></h3>  
  <input   type="text"   id="txt"   value="0"   runat="server"   NAME="txt"   />  
  <form   runat="server"   ID="Form1">  
  <asp:DropDownList   id="DropDown1"   runat="server"   AutoPostBack="True"   OnSelectedIndexChanged="OnIDChanged">  
  <asp:ListItem>Item   1</asp:ListItem>  
  <asp:ListItem>Item   2</asp:ListItem>  
  <asp:ListItem>Item   3</asp:ListItem>  
  <asp:ListItem>Item   4</asp:ListItem>  
  <asp:ListItem>Item   5</asp:ListItem>  
  <asp:ListItem>Item   6</asp:ListItem>  
  </asp:DropDownList>  
  <asp:button   text="Submit"   OnClick="SubmitBtn_Click"   runat="server"   ID="Button1"   />  
  <p>  
  <asp:Label   id="Label1"   font-name="Verdana"   font-size="10pt"   runat="server">  
                      Select   a   value   from   the   list  
                  </asp:Label>  
  <br>  
  <%  
  dim   i  
  for   i=1   to   6%>  
  <input   type="button"   value="Item   <%=i%>"   onclick="DoClick(<%=i%>)">  
  <%next%>  
  <br>  
  <span   id="span1"   runat="server">0</span>  
  </form>  
  </body>  
  </html>  
 

NO.2   作者: saucer

the   SelectedIndexChanged   is   triggered   if   you   click   on   Submit   button,   if   you   want   to   trigger   it   right   away,   according   to   the   documentation:  
   
  http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/events/onchange.asp  
   
  "  
  ....  
  The   onchange   event   does   not   fire   when   the   selected   option   of   the   select   object   is   changed   programatically  
  ..."  
   
  so   after   you   change   the   value,   you   should   call   onchange()   or   call   form.submit()   yourself,   for   example  
   
                    scriptString   +=   "alert(span1.innerHTML);"  
  scriptString   +="document.all(""DropDown1"").onchange();"  
                    scriptString   +=   "}</"  
                    scriptString   +=   "script>"  
 


 ·xp控制台的修复命令是什么啊    »显示摘要«
    摘要: 指教啦 ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE