Showing posts with label raised. Show all posts
Showing posts with label raised. Show all posts

Saturday, March 24, 2012

Exception Problem

Hi...
I've a problem when exceptions are raised using a ASP.NET AJAX framework.

I have a exception raised inside a updatepanel, and its show an alert wrote :
"Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occured while processing the request on the server. The status code returned from the server was: 500."
and this message dont correspond with the real Exception message.

When I used the event "AsyncPostBackError" of ScriptManager, the Exception that received in the e.Exception parameter its the correct exception and message that was raised.


thanks

Hi

for myself, i got this error when something wrong to call web services...(i am not sure you have web services in your call or not)

here is another thread about same issue. have a look

http://forums.asp.net/thread/1474598.aspx


Well,

I'm not uses a webservice in this case. The error occur when is raised my personalised Exception (throw new exception("my error")).

Someone have a answer?

Thanks...

Wednesday, March 21, 2012

Events

I would like to know if it is posible to obtain the data from theAtlas:datasource object via javascript.
When thedataAvailable event is raised, I'm able to capturre the event in javascript.
I see that it is sending two arguments with the event. I belive the first argument is the
sender and the second is an empty args value. Please correct me if this is wrong.

<!--
<div><spanid="RES">Some type of test data</span></div>


<atlas:DataSourcerunat="server"id="DataSource1"serviceUrl="~/DataService.asmx">
<dataAvailableHandler="traceDataAvailable1">
</dataAvailable>
</atlas:DataSource>

<scripttype="text/javascript">
function traceDataAvailable1()
{

var obj = arguments[0];
window.document.getElementById("RES").innerText = obj ;

}
</script>
-->

In your handler, "obj" will represent the datasource. So, to get to the data, you should do obj.get_data().
On a related note: you can rewrite traceDataAvailable1() to:
function traceDataAvailable(sender, eventArgs) {
...
}
Also, to display the data in the "res" span, you probably want toiterate over the contents of in the data object and concat it to the"innerHTML" property of the span.

Event raised when toggling between tabs

Hi

I am using ajax tab panel. The problem is, I am unable to capture any event when I toggle between tabs. Actually I am generating the tab panel dynamically, now I want to change the color of a help menu when the user toggles between the tabs. For this to happen I need some kind of event but could not get it.

I tried using "onclientclick" but that was not helpful.A

Help needed

Regards

Abhishek

Take a look here: http://asp.net/AJAX/Control-Toolkit/Live/Tabs/Tabs.aspx

Either theOnClientActiveTabChanged orActiveTabChanged event should be what you're after.


Thanks you very much for solving my problem


My master page is

<%@.MasterLanguage="C#"AutoEventWireup="true"CodeBehind="Site1.master.cs"Inherits="TabSample.Site1" %>

<%@.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="cc1" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">

<title>Untitled Page</title>

</head>

<body>

<formid="form1"runat="server">

<div>

<asp:ContentPlaceHolderID="ContentPlaceHolder1"runat="server">

</asp:ContentPlaceHolder>

<tablerunat="server"id="tbtest">

<trrunat="server"id="trtest">

<tdrunat="server"id="tdtest">

<asp:labelid="spn"runat="server">HELLO</asp:label>

</td>

</tr>

</table>

</div>

</form>

</body>

</html>

My content page.aspx is:

<%@.PageLanguage="C#"MasterPageFile="~/Site1.Master"AutoEventWireup="true"CodeBehind="Default.aspx.cs"Inherits="TabSample._Default" %><%@.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="cc1" %>

<asp:ContentID="Content1"ContentPlaceHolderID="ContentPlaceHolder1"runat="server">

<scripttype="text/javascript"language="javascript">

function ActiveTabChanged(sender, e){ __doPostBack('<%= tabs2.ClientID %>',sender.get_activeTab().get_headerText());

}

</script>

<asp:ScriptManagerID="ScriptManager1"runat="server"EnablePartialRendering="true">

</asp:ScriptManager>

<asp:UpdatePanelID="OuterUpdatePanel"runat="server"UpdateMode="Conditional">

<ContentTemplate>

<cc1:TabContainerrunat="server"ID="tabs2"Height="150px"OnClientActiveTabChanged="ActiveTabChanged"OnActiveTabChanged="DoServerSideValidation">

<cc1:TabPanelrunat="Server"ID="TabPanel0"HeaderText="Tab One">

<ContentTemplate>

This is panel 1

</ContentTemplate>

</cc1:TabPanel>

<cc1:TabPanelrunat="Server"ID="TabPanel1"HeaderText="Tab Two">

<ContentTemplate>

This is panel 2

</ContentTemplate>

</cc1:TabPanel>

</cc1:TabContainer>

</ContentTemplate>

<Triggers>

<asp:AsyncPostBackTriggerControlID="tabs2"EventName="ActiveTabChanged"/></Triggers>

</asp:UpdatePanel>

</asp:Content>

My content page.cs is:

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;

using AjaxControlToolkit;

namespace TabSample

{

publicpartialclass_Default : System.Web.UI.Page

{

#region designer control

protectedScriptManager ScriptManager1;

protectedTabContainer tabs2;

protected System.Web.UI.HtmlControls.HtmlTable tbtest;

protected System.Web.UI.HtmlControls.HtmlTableCell tdtest;

#endregion

protectedvoid Page_Load(object sender,EventArgs e)

{

ScriptManager1.RegisterAsyncPostBackControl(tabs2);

}

protectedvoid DoServerSideValidation(object sender,EventArgs e)

{

TabContainer tc;

tc = (TabContainer)sender;

string str;

if (tc.ActiveTabIndex == 0)

{

str ="#99ccff";

}

else

{

str ="#505050";

}

HtmlTableCell _tdtest;

_tdtest = (HtmlTableCell)Master.FindControl("tdtest");

string str1 = _tdtest.InnerText.ToString();

string str2 = _tdtest.InnerHtml.ToString();

_tdtest.Attributes.Add("bgcolor", str);

_tdtest.Style.Add("background-color", str);

_tdtest.InnerText ="TESTESTS";_tdtest.Visible =false;

}

}

}

The problem is although the server side event "DoServerSideValidation" fires and executes the desired change is not reflected in the master page.

Help sought.

Thanks.