|
Do as the information page says, and you will be able to see the real error message.
---
b { font-weight: normal; }
|
|
|
|
|
this server error comes for so many reasons..check ur web.config file.may be there is something wrong in it.if it is not then let me know
|
|
|
|
|
Hi,
In my web application (framework 1.1), I have a try-catch block handling errors. When an error occurs it is logged using Logging of EL. Later I also need to navigate to a CustomErrorPage created. Here is how the web.config tag looks like.
<customerrors mode="RemoteOnly" defaultredirect="CustomErrorPage.aspx">
The catch portion looks like this:
catch(Exception ex)
{
#region Log DS Retrieval Error
LogEntry l = new LogEntry();
l.Severity = Severity.Error;
l.Category = "General";
l.Message = String.Format("Encountered error during data retrieval {0}", ex.ToString());
l.Priority = 5;
l.EventId = 13651;
l.Title = "Data Retrieval";
Logger.Write(l);
#endregion
throw ex;
}
When I use the mode as "RemoteOnly" it does not navigate to the error page nor does it give the detailed error page. It just displays error details like error is not handled. When the mode is set to "On" it navigates to the Error Page stipulated.
Any ideas/input on how to incorporate the RemoteOnly mode to display detailed error page on the Webserver and Custom Error Page for the user?
Thanks
Minu
|
|
|
|
|
Hi everyone,
I added a GridViewRow dynamically that has a textbox. I type something into textbox and do a postback, but the textbox is empty. I'm rebinding the gridview on Page_Load everytime, but I can not see where there issue lies. Can someone take a look at my code and see if they can catch it?
aspx file ..................................................
<%@ Page Language="C#" trace ="true" AutoEventWireup="true" CodeFile="Default9.aspx.cs" Inherits="Default9" %>
<title>Untitled Page
<asp:gridview id="GridView1" runat="server" allowsorting="True" autogeneratecolumns="False" datakeynames="categoryid" datasourceid="SqlDataSource1" onrowdatabound="onGVRowDataBound">
<columns>
<asp:boundfield datafield="categoryid" headertext="categoryid" insertvisible="False"
="" readonly="True" sortexpression="categoryid">
<asp:boundfield datafield="description" headertext="description" sortexpression="description">
<asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="<%$ ConnectionStrings:JimTestConnectionString %>"
="" deletecommand="DELETE FROM [Category] WHERE [categoryid] = @categoryid" insertcommand="INSERT INTO [Category] ([description]) VALUES (@description)" selectcommand="SELECT top 10 [categoryid], [description] FROM [Category]" updatecommand="UPDATE [Category] SET [description] = @description WHERE [categoryid] = @categoryid">
<deleteparameters>
<asp:parameter name="categoryid" type="Int32">
<updateparameters>
<asp:parameter name="description" type="String">
<asp:parameter name="categoryid" type="Int32">
<insertparameters>
<asp:parameter name="description" type="String">
cs file..................................
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Default9 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DataBind();
}
protected void onGVRowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
Table objParentTable = ((Table)e.Row.Parent);
objParentTable.ID = "Table1";
GridViewRow objTableRow = new GridViewRow(-1, -1, DataControlRowType.DataRow, DataControlRowState.Normal);
objTableRow.ID = "GVRow2nd";
objParentTable.Controls.Add(objTableRow);
TableCell objTableCell = new TableCell();
objTableCell.ID = "firstCell";
//jTableRow.Cells.Add(objTableCell);
objTableRow.Controls.Add(objTableCell);
TextBox objTB = new TextBox();
PlaceHolder objPH = new PlaceHolder();
objPH.Controls.Add(objTB);
objTableCell.Controls.Add(objPH);
objTableCell.ID = "firstCell2";
objTB.ID = "firsttextbox";
objPH.ID = "firstPlaceHolder";
}
}
}
Great thing comes to those who share
|
|
|
|
|
Your code binds data to the grid on every page load. Because of this you are loading a new grid from the database. Anything typed in the grid will be lost when you call the databind() method. What you need to do is save the text entered in the grid and recreate the row. Or just bind the grid once using ifnotpostback() and then bind it again as needed.
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
Hi, Thanks for helping.
I read somewhere that we specifically needed to rebind on every page load so that the dynamically created control can repopulate its viewstate. If I don't do the rebind on page_load, the GridViewRow/Textbox will disappear upon postback.
I tried bind once and rebind after a postback but still the text box is empty.
can you elaborate on this point?
What you need to do is save the text entered in the grid and recreate the row.
Do you mean store text in hidden field or viewstate and manually repopulate the textbox when binding?
Thank You
Jim
silverfox_1188
|
|
|
|
|
One possible solution...
When your page post's back find the row
foreach (GriedViewRow row in gridview.rows)
{
//find your row via some key or id that you add to the row
Textbox txt = (TextBox) row.findcontrol("txtbox1");
viewstate["txtbox1Value"] = txt.text;
}
Now when you go bind the grid again you will have the value
TableCell objTableCell = new TableCell();
objTableCell.ID = "firstCell";
//jTableRow.Cells.Add(objTableCell);
objTableRow.Controls.Add(objTableCell);
TextBox objTB = new TextBox();
//Add the following
objTB.text = viewstate["txtbox1Value"].ToString();
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
Hi, Thank You again.
I try your suggestion and it works great. We always do grid databind on Page_Load, then onCommand button event, we store the textbox values into the viewstate, after that the sqldatasource automatically rebinds after prerender, this time we repopulate the values from viewstate.
In your oppinon, is it worth the performance hit to create dynamic controls and having to rebind on every page_load and after prerender? We could have simply placed the 2 text boxes outside of the gridview instead of adding it to the grid dynamically. It would have been easier to code but my client insisted on having them inside. What do you recommend?
thanks again,
Jim
silverfox_1188
|
|
|
|
|
actually you shouldn't rebind.
store the table inside your view state
and on page load rebind to the table from viewstate.
theres no need to cache specific row data
private DataTable myTable = new DateTable(...);
pageLoad
if(!PostBack)
myTable = ... get the data from your biz layer ...;
ViewState["MyTable"] = myTable;
set data grid
else
DataGrid.DataSource = ViewState["MyTable"] as DataTable;
rebind
The reason why your changes are not shown is this.
First you create a table which has a unique identifier attached to it.
So you make changes and repost
When you get a new data table you have a different unique identifier which .net will wipe any changes and events tied to that source
You need to rebind every time, but use the table from the ViewState.
Also if you need to add format additional controls use the ItemCreated event to format them.
If you data bind them there, you shouldn't have a need to hack the form and make life difficult
Nick
--------------------------------------------------------
1 line of code equals many bugs. So don't write any!!
My mad coder blog
|
|
|
|
|
Thank You everyone for your valuable insights!
silverfox_1188
|
|
|
|
|
Hi Everyone,
I am working on this project in ASP.NET and I used this code, and I wanted to to output as currency which SHOULD work, but it won't.
<%# DataBinder.Eval(Container.DataItem, "invoicetotal","{0:c}") %>
Is there something that I am doing wrong, no commas or dollar signs show up when I use that for some reason.
Thanks,
The Major Rager
|
|
|
|
|
Put this DataFormatString="{0:C}" in the tag but outside of the databinder.
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
Thanks for your help!
Sincerely,
The Major Rager
|
|
|
|
|
Hi,
Cache is used to store frequently used data and read only data.
Application state is to provide a share point for accessing global, read-only data in an application.
Then What is the difference between Application and Cache.
Which is best in which scenario.
Thanks in advance.
|
|
|
|
|
The difference is that items in the cache will be dropped when the memory resources are better used for something else. If you store too much in the Application object, the server will run out of free memory and start swapping virtual memory to disk, which will make the server very slow.
---
b { font-weight: normal; }
|
|
|
|
|
HI all
I am trying to Redirecting the page to flash file from "page1.aspx" page
Response.Redirect("Play.swf")
But the flash file is not working
But after refreshing the Play.swf page is working
Can any one tell me what is the error
THX
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf
|
|
|
|
|
I dont know why... But why dont you just redirect to an aspx page as normal, and you can embed the swf file in there ...
<< >>
|
|
|
|
|
Hi Everyone,
I am working on a project where I am going to need to make a few charts and graphs using Excel. I do not have the Office tools for Visual Studio and I was wondering what was the best way to do this. The graphs also should not be just an image, but interactive where I can hover or click one of the bars on the bar graph and it should tell me something. If anyone can give me a few ideas I would truly appreciate it.
Thanks
|
|
|
|
|
Because you are using chart in an ASP.NET application, I think you may consider using a third party component like Dundas Chart[^].
|
|
|
|
|
Can any one have idea, how to build one asp.net application via anotherone asp.net application?. Example: BuildApp.aspx contains one TexBox and Button, if enter a filename to be build in the Textbox and click the Button, it should build the application as we doing thru vs.net IDE build menu.
Thanks in Advance
|
|
|
|
|
you could probable use ShellExecute or similar to spawn MSBuild with the correct command line
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
Thanks for your tips. It would be very helpful to me if u show me some code or link which explains this ShellExecutable technique.;)
|
|
|
|
|
ShellExecute is a WIN32 API function - not sure how you'd go about accessing it from .NET tbh - haven't used it for a while! Think there's something in System.Diagnostics for running a process - MSDN will help
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
|
Use the codeDom namespace to create code on the fly and compile it
--------------------------------------------------------
1 line of code equals many bugs. So don't write any!!
My mad coder blog
|
|
|
|