Environment.newline and UpdatePanel

Category: ASP.NET Questions, Dot Net Questions, Latest Questions, Latest Topics    |    0 views    |    Add a Comment

I have a simple multiline textbox in an updatepanel.  When I click on my command button the text from the textbox is sent to my data access class as input to a stored procedure.  Latter I try to view the value from the database like so:

 <asp:Label ID="ltContent" Text='<%#Eval("Content").ToString().Replace(Environment.NewLine, "<br />") %>' runat="server"></asp:Label>

The problem is that Replace(Environment.NewLine, "<br />") is not working - I get one long line of text without the breaks.  If I copy the field directly from the database using SQL Server Management Studio and paste it into a text editor, I can see that the line breaks are there.  Now, if I get rid of the UpdatePanel and use the same code to send the multiline text to the stored procedure, everything works as expected when I display it (I get like breaks).  What could be causing this?

 

Share/Save/Bookmark

 

How to delete folder from the project using C# code

Category: ASP.NET Questions, Dot Net Questions, Latest Questions, Latest Topics    |    0 views    |    Add a Comment

Hi everybody i am facing a problem in Deleting a folder from my project.

the case is like this : I want to delete the folder of a perticuler client which is in    Images/clients/ (each folder for client). so i have written a code like this

DirectoryInfo dire = new DirectoryInfo(Server.MapPath("..//Images//client//"));

foreach(DirectoryInfo d in dire.GetDirectories())

{

         if (d.Equals(Request.QueryString["id"]))

           {

                  FileInfo[] TheFile = dire.GetFiles();                 foreach (FileInfo ff in TheFile)

                 {

                         if (ff.Exists)

                            {

                                 File.Delete(Server.MapPath("..//Images//client//") + Request.QueryString["id"].ToString());

                          }

                 }

                d.Delete();

          }

}

 

There is no error in this code but the condition ' if (d.Equals(Request.QueryString["id"])) ' is not satisfying. it is always false.

Request.QueryString["id"]  gets the id of the client which is also the name of the client folder.

 

Share/Save/Bookmark

 

Error help needed!!

Category: ASP.NET Questions, Dot Net Questions, Latest Questions, Latest Topics    |    0 views    |    Add a Comment

Server Error in '/' Application.


Data type mismatch in criteria expression.

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.Data.OleDb.OleDbException: Data type mismatch in criteria expression.

Source Error:

Line 18:         protected void submitbutton_Click(object sender, EventArgs e)
Line 19:         {
Line 20:             this.SqlDataSource1.Insert();
Line 21:             //clear session
Line 22:             Session.Clear();

Source File: C:\Users\CutieYz\Documents\Visual Studio 2005\Projects\OrderWebApp\OrderWebApp\OrderForm.aspx.cs    Line: 20

Stack Trace:

[OleDbException (0x80040e07): Data type mismatch in criteria expression.]
   System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +267
   System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +192
   System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +48
   System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +106
   System.Data.OleDb.OleDbCommand.ExecuteNonQuery() +108
   System.Web.UI.WebControls.SqlDataSourceView.ExecuteDbCommand(DbCommand command, DataSourceOperation operation) +404
   System.Web.UI.WebControls.SqlDataSourceView.ExecuteInsert(IDictionary values) +447
   System.Web.UI.WebControls.SqlDataSource.Insert() +13
   OrderWebApp.OrderForm.submitbutton_Click(Object sender, EventArgs e) in C:\Users\CutieYz\Documents\Visual Studio 2005\Projects\OrderWebApp\OrderWebApp\OrderForm.aspx.cs:20
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746

 

i have no idea what is wrong with it!! please  help me get the possible error!!

Share/Save/Bookmark

 

Creating high performance WCF services

Category: ASP.NET Questions, Dot Net Questions, Latest Questions, Latest Topics    |    2 views    |    Add a Comment

I had a WCF service where I wanted to be able to support over a hundred concurrent users, and while most of the service methods had small payloads which returned quickly, the startup sequence needed to pull down 200,000 records. The out of the box WCF service had no ability to support this scenario, but with some effort I was able to squeeze orders of magnitude performance increases out of the service and hit the performance goal. Initially performance was abysmal and there was talk of ditching WCF entirely ( and as the one pushing WCF technology on the project this didn't seem like a career enhancing change ) Here's how performance was optimized: Use NetTCP binding This helps both throughput and the time it takes to open and close connections…(read more)

Share/Save/Bookmark