|
5/28/2009 12:55:24 PM
|
topic:
Редактиране на web control
desi24 Posts 1
|
когато искам да редактирам контрола и след това след натискане на бутона за запис с Interenet Explorer (с др. браузъри работи) ми дава следната грешка
Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.] System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +306 System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134 System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +221 System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134 System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +221 System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134 System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +221 System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134 System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +221 System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134 System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +221 System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134 System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +221 System.Web.UI.Page.LoadAllState() +312 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1661
|
|
5/8/2009 12:09:30 AM
|
topic:
asp и пускане в действие
embaka Posts 1
|
здрасти, имам една система на асп и се опитвам да я пусна, но при зареждане на сайта започва да ми тегли index.asp. някой ще ми обясни ли по какъв начин да го подкарам това чудо.
MySQLSVR = "127.0.0.1" MySQLPRT = 3306 MySQLUID = "root" MySQLPWD = "пасс" MySQLDB = "asp" MySQLOPT = 16386
това ми са портовете, базата данни, името на базата и т.н. базата е на mysql
|
|
11/9/2008 1:01:28 PM
|
topic:
Как да даунлоадна файл
todorradev Posts 2
|
Примерът предполага, че имате таблица с базата данни на следните свойства
Табица Files - FileId ( int),FileName(varchar),FileBytes(Varbinary(Max)
ASP.NET
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="FilesList.aspx.vb" Inherits="FilesManagment_FilesList" %> <!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> <style type="text/css"> .style1 { font-weight: bold; } </style> </head><body> <form id="form1" runat="server"> <div> <p> <span class="style1" lang="en-us">Uplaod File</span></p> <div> <asp:Label ID="Label1" runat="server" Text="File Name"></asp:Label> <asp:TextBox ID="TextBox1" runat="server" Width="200px"></asp:TextBox> <br /> <asp:FileUpload ID="FileUpload1" runat="server" /> <br /> <asp:Button ID="Button1" runat="server" Text="upload" /> </div> <p> <span class="style1" lang="en-us">Files List : </span> </p> <br /> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="FileId" DataSourceID="SqlDataSource1"> <Columns> <asp:BoundField DataField="FileId" HeaderText="FileId" ReadOnly="True" SortExpression="FileId" /> <asp:BoundField DataField="FileName" HeaderText="FileName" SortExpression="FileName" /> <asp:TemplateField> <ItemTemplate> <asp:LinkButton ID="LinkButton1" runat="server" CommandArgument='<%# Eval("FileId").ToString() + ";" + Eval("FileName") %>' CommandName="Download">Download</asp:LinkButton> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT [FileId], [FileName] FROM [Files]"></asp:SqlDataSource> <br /> </div> </form></body></html>
VB Code Behind :
Imports System.Data.SqlClientPartial Class FilesManagment_FilesList Inherits System.Web.UI.Page Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView1.RowCommand If e.CommandName = "Download" Then Dim Fileinfo() As String = e.CommandArgument.ToString().Split(";") Dim FileId As Integer = Fileinfo(0) Dim FileName As String = Fileinfo(1) Using con As New SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString) Dim com As New SqlCommand("select FileBytes from Files where FileId=@FileId ") com.Parameters.AddWithValue("@FileId", FileId) com.Connection = con con.Open() Dim FileBytes As Byte() = com.ExecuteScalar Response.AddHeader("Content-Disposition", "attachment; filename=" & FileName + ".zip") Response.ContentType = "application/octet-stream" Response.BinaryWrite(FileBytes) End Using End If End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Using con As New SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString) Dim com As New SqlCommand(" Insert into Files (FileName,FileBytes) values(@FileName,@FileBytes) ") com.Parameters.AddWithValue("@FileName", TextBox1.Text) com.Parameters.AddWithValue("@FileBytes", FileUpload1.FileBytes) com.Connection = con con.Open() Dim Saved As Boolean = com.ExecuteNonQuery() > 0 If Saved Then GridView1.DataBind() End If End Using End SubEnd Class edited by todorradev on 11/9/2008
|
|
11/9/2008 12:52:42 PM
|
topic:
Как да даунлоадна файл
ksarafov Posts 1
|
Как да даунлоадна файл използвайки Click Evеnts на бутон
|
|
страници:
1
|