|
|
Hi all,
I am running ASP 2 on IIS 5.1 XPPRO and I have enabled customErrors, so i though i would see how they look locally and set mode=On.
this is the code that fires the exception:
protected void AddToQuoteButton_Click(object sender, ImageClickEventArgs e)
{
try
{
Guid guid = new Guid(Request.QueryString["id"]);
QuoteManager.AddToQuote(Page, guid);
}
catch (Exception ex)
{
throw new Exception("Illegal Product Code in query string.", ex);
}
}
and this is the custom 500 error page logic
public partial class _500 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if(Server.GetLastError() != null)
{
string error = Server.GetLastError().Message;
ErrorLabel.Text = error;
Server.ClearError();
}
}
}
so i load a page which requires a Guid on the querystring (but i chop some of the guid off) then click the button whose handler is above, and it goes to the 500.aspx page but Server.GetLastError() is always null.
note: it is suppose to go to 500.aspx on load but i disabled that to do some testing.
why is this?
kind regards,
g00fy
-- modified at 2:02 Thursday 13th July, 2006
this is the web.config section
<customErrors mode="On" defaultRedirect="~/500.aspx">
<error statusCode="404" redirect="~/404.aspx"/>
</customErrors>
|
|
|
|
|
Try above code in Page_Error event, rather than Page_Load
It always return null in Page_Load
Kumar Prabhakar
|
|
|
|
|
|
thank you both
regards,
g00fy
|
|
|
|
|
My problem is like this.
In a page i have controls to add contacts
FirstName
Lastname
Address
Zip etc..
The page has two buttons "Add " and "Save "
+ on clicking Add button the content in the controls need to be stored temporarly in client client. And listed in a table below. Its also possible to delete an item from Added list.
+ on clicking Save all contacts stored temporarily need to be submitted to server and update to the database
means post back must occur only on clicking "Save "
How to do this. It must support cross browser.
|
|
|
|
|
|
postback will happen as per you solution
|
|
|
|
|
Private dt As New DataTable
In Page_Load event
If Not Page.IsPostBack Then
dt.Columns.Add("fName", GetType(System.String))
dt.Columns.Add("lName", GetType(System.String))
viewstate("dt") = dt
End If
In btnAdd_Click Event
Dim dt As DataTable = viewstate("dt")
Dim dr As DataRow
dr = dt.NewRow
dr(0) = txtFname.Text
dr(1) = txtLName.Text
dt.Rows.Add(dr)
DataGrid1.DataSource = dt
DataGrid1.DataBind()
viewstate("dt") = dt
On Save Click, You should get table from viewstate variable and store data in database
Kumar Prabhakar
|
|
|
|
|
If you don't want a postback to occur when clicking the add button you can either use some javascript to save the values to a hidden field or use AJAX to place them in temporary storage (session, database...) until the save button is clicked.
|
|
|
|
|
Hai mark
Thanks for your time
Can you provide me with some snippet/article to do it using JavaScript.
|
|
|
|
|
Can any body help me to get a detailed book on Microsoft content management server 2002?
i am very much in a need of that.
advanced ThanX
Ramesh.Kanjinghat
|
|
|
|
|
Hi all
I want to put the (i, j) values into a 2 Dimensional Array
Can any one plz give the syntax of this
MYCODE
-----------------------------
Dim i As Integer
Dim j As Integer
For i = 0 To a
For j = 0 To b
Console.WriteLine(NewData(i, j))
Next
Next
------------------------------
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf
|
|
|
|
|
IMHO, you may either pick up a basic programming book or see MSDN for this kind of questions.
Arrays in Visual Basic [^]
Also, your question should belong to the VB.NET forum, not the ASP.NET.
|
|
|
|
|
Hi
Thx for reply
'--------------------------------------------------------
Dim i As Integer
Dim j As Integer
For i = 0 To a
For j = 0 To b
Response.Write(NewData(i, j) & "")
Next
Next
'---------------------------------------------------------
In my code i am trying to add the (i,j) values to array
The array is not taking the values of (i,j)
I add like this
'---------------------------------
Dim Data As New ArrayList
data.add(NewData(i, j)
'---------------------------------
How can i retrive the (i,j) from here
THX
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf
|
|
|
|
|
I have a slight problem, I am developing an ASP.NET 2.0 website that uses themes (currently only one). The site theme is specified in web.config as <pages styleSheetTheme="White"/> . It was working great until I wanted to start adding RSS support. I am adapting an rss example from the Atlas wiki site starter kit. The aspx file is just an empty aspx file and the aspx.cs file generates the xml, and delivers it via Response.Write . I have used this method in previous asp.net 2.0 applications without problem, however this is my first time with themes.
My problem is this:
System.InvalidOperationException: Using themed css files requires a header control on the page. (e.g. <head runat="server" />).
I tried setting EnableTheming to false for the page and had the same problem. Anyone have any ideas?
Matt Newman
Even the very best tools in the hands of an idiot will produce something of little or no value. - Chris Meech on Idiots
|
|
|
|
|
Hi there,
There are a couple of options suggested from the link[^]:
+ Make the header invisible.
+ Use the RSS Toolkit
...
|
|
|
|
|
The invisible header worked.. which seems odd but it works. I am looking into the RSS Toolkit.
Thanks for the help.
Matt Newman
Even the very best tools in the hands of an idiot will produce something of little or no value. - Chris Meech on Idiots
|
|
|
|
|
hi all,
Last time i posted a posted query on alphabetic paging of Datagrid in C#. there was no solution.
Expecting a solution for this new one:
i have javascript file named "validate-search.js"
i have to use a fuction called "validate-alpha-search" from the above .js file
how to include this function in my current asp.net page using Register clientScriptInclude?
thnaks in advance
Anu
|
|
|
|
|
RegisterClientScriptInclude doesn't work? Perhaps you would like to include how you are trying to use it.
|
|
|
|
|
hi friend!
Thanks for the reply.
i think u mistook my query. i would like to know how to use it in correct manner.
i used it like this: in the button_click event
String includejs = "validate-search.js"
Page.ClientScript.RegisterClientScriptInclude("validate-alpha-searh",includejs);
but when i click the button, nothing happens, so what was my mistake in here. plz help me.
|
|
|
|
|
I did not mistook your query (no matter how much you bold it. You did not present all of the information.
anu_chandu wrote: i used it like this: in the button_click event
The button_click event you now mention is a server-side event correct? It is too late to validate your search with js because the client has already posted back to the server. You should include the RegisterClientScriptInclude in the page load event so it will be present and usable when the page is initially rendered.
|
|
|
|
|
Hey all, I've got an aspx page that reads and writes cookies in both asp and javascript, the problem is when i go to read the cookies they are written in two different spots in IE (not a problem in Mozilla it seems). ASP writes them to the root dir (i.e. loclahost or www.blah.com) while js writes them to localhost/(page dir). Now when i go to read the cookie asp finds both while js only finds the on it wrote. How do i force them to be the same??
|
|
|
|
|
I need to stream mpeg-2 files from Windows Server 2K3 - basic requirement is that the file is gone from the user's system when done playing. Anyone have any experience in this area? Any SDK's or 3rd party tools?
|
|
|
|
|
microsoft streaming media server, or create a small flash player and stream it through that, this can be created dynamically by passing in arguments that are retreived from db or other source.
You can also access MS SMS in code but it must be installed on your server, so if it is not your server then flash is probably the easiest option.
hth
g00fy
|
|
|
|