Showing posts with label custom. Show all posts
Showing posts with label custom. Show all posts

Wednesday, March 28, 2012

Accessing Masterpage Ajax control from Web user control

Hi all,

I have created a master page in asp2.0 and i have placed ModalPopupExtender in that. I have written a custom Textbox control. In that text Changeded event i have created reference to the Masterpage modalpopupextender using Findcontrrol method. But i cant able to loop through tge Master page controls Properly. I am unable to findthe controls with its client id. Can anybody know how to solv this.

My aim is to call the modalpopupextender show event from the custom control.

<cc1:ModalPopupExtenderID="ModalPopupExtender1"runat="server"TargetControlID="btnForLookup"PopupControlID="LookupPanel"BackgroundCssClass="modalBackground">

Private

Sub AHNLookup_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)HandlesMe.Click

{ Dim contr as ModalpopupExtender

Contr = Me.page.master.FindControls("ModalPopupExtender1")

Constr.show() -->Gives error as Null object.

}

====

Thanks in advance.

S.Sathishraja

Hi,

Please try to find it in a recursive way.

public?Control FindControlRecursive(Control root, string id)
{
????if (root.ID == id)
????{
????????return root;
????}

????foreach (Control c in root.Controls)
????{
????????Control t = FindControlRecursive(c, id);
????????if (t != null)
????????{
????????????return t;
????????}
????}

????return null;
}
Hope this helps.

Monday, March 26, 2012

accessing arg.IsValid from callback function.

I have a custom validator on an aspx page which calls the function below: the args object passes in the value from a dropdownlistbox and has a property IsValid. The problem I'm facing is I don't have access to the results ofOnDoesExchangeRageExistComplete in the main fuction, because I want to set args.IsValid to the result. Any ideas on how I can do this?

This is the manin function called from the aspx page

functionDoesExchangeRateExist(sender, args)
{
//pass in the period date in args.value to the webservice.
UtilityService.DoesExchangeRateExist(args.Value, OnDoesExchangeRageExistComplete); //What I would like to do is set args.IsValid to the result of the webservice call. Because this determines if the page is submitted.
}

//----------------------------------

function

OnDoesExchangeRageExistComplete(result)
{
var errMsg = document.getElementById( "lblErrorMsg");
if(result ==true)
{
errMsg.innerHTML =""
returntrue;
}
else
{

errMsg.innerHTML =

"Exchange rates are not available for selected period date. Please select a different period date."\n

returnfalse;\n

}

\n

}

\n

\n

thanks,

\n

Garfield.

\n\n",0]);D(["ce"]);//-->returnfalse;

}

}

thanks,

Garfield.

I think you can returnargs.IsValidas a return value of the WebMethod?UtilityService.DoesExchangeRateExist?and access it in the callback of the client side through javascript.
Try to take a look at the following for details about calling web service in javascript from the client side.
If the web service class on the server includes a web method that does not return data, you can call the web service without having to handle a response. This is the simplest web method call that can be made from the client. For example, your application has the following web method:
?
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[Microsoft.Web.Script.Services.ScriptService]
public class Parts : System.Web.Services.WebService
{
[WebMethod]
public void NoReturn()
{
//do work here
System.Threading.Thread.Sleep(2000);
}
}
?
The following JavaScript can be used to invoke that web method
?
function RunWebService()
{
Parts.NoReturn();
}
?
If the webservice is in a custom namespace, you would need to fully
qualify the call to the webservice. For example, if the WebService
has a namespace of MyCustomNameSpace.WebServices, the above JavaScript
becomes:
?
function RunWebService()
{
MyCustomNameSpace.WebServices.Parts.NoReturn();
}
?
Getting a return value?
In a scenario where the web method has a return value, then the asynchronous invocation model requires providing a callback function that will be called when the web service call returns. The callback function has an input parameter that contains the results of the web service call.
?
The server-side AJAX stack will appropriately serialize the return value from the web method, and the client-side AJAX stack will deserialize the data to an appropriate JavaScript type to be passed to the callback function.
?
On the Server-side, there is a WebMethod that returns a string:
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[Microsoft.Web.Script.Services.ScriptService]
public class Parts : System.Web.Services.WebService
{
[WebMethod]
public string DynamicDropdown()
{
string tmpDropDown;
tmpDropDown = "<select id=test name=test><option value=Part1>Part1</option><option value=Part2>Part2</option></select>";
return tmpDropDown;
}
}
?
When you call the web service in client script, the call will need to have a callback function specified to handle the return value. The following script demonstrates calling the DynamicDropdown WebMethod of the Parts Web Service and specifies OnComplete as the callback function. The OnComplete function has an input paramter which is the return object from the web service call, in this case, this will be the string value. The OnComplete function then takes the return value and inserts it as the innerHTML property of a span with ID DynamicArea. The result is that a dropdown appears on the page.
function InsertDropdown()
{
Parts.DynamicDropdown(OnComplete);
return false;
}
function OnComplete(result)
{
DynamicArea.innerHTML += result;
}
Passing primitive type parameters to web method
If the web method takes input parameters, then the JavaScript invocation of the method will take corresponding JavaScript parameters. The parameter values will be serialized by the AJAX stack into JSON and packaged in the body of the request and then de-serialized as .Net types corresponding to the signature of the web method.
?
For example, given the following server method that accepts a string parameter and returns a string:
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[Microsoft.Web.Script.Services.ScriptService]
public class Parts : System.Web.Services.WebService
{
[WebMethod]
public string EchoString(String s)
{
return s;
}
}
?
You would use the following JavaScript to call the web service, pass the string parameter and include the callback function:
?
function CallEchoString()
{
Parts.EchoString(form1.GetString.value, OnCallBack);
}
function OnCallBack(results)
{
alert(results);
}
?
The call to the EchoString web method on the Parts.asmx web service is taking the value from a textbox named GetString in a form with ID of "form1" to pass as the input parameter and specifying OnCallBack as the callback function. The OnCallBack function has an input parameter of "results" which is the return type from the EchoString web method. The JavaScript then displays that in a popup box.
Specifying a callback for failure cases?
If the request to the web method is unsuccessful, whether because of error, timeout, or if server code aborts the request, then the callback specified for successful completion will not be called. A second callback function can be specified in the call to the web service for failure cases, receiving an error object as parameter, as in the following javascript:
?
function CallService()
{
PeopleServices.ThrowError(OnCallBackThrowError, OnError);
}
function OnCallBackThrowError(result)
{
alert("OnCallbackThrowError: " + result);
}
function OnError(result)
{
alert("OnError: " + result.get_message());
alert(result.get_stackTrace());
}
?
In the code sample, the ThrowError method of the PeopleServices web service does not take any input parameters. The method call passes the callback function "OnCallBackThrowError" and a method for handling any error condition called "OnError". The OnError method takes an input parameter which is a error object that contains the error message and stack information passed from the server if a .NET Exception was thrown. In this case, the information is displayed in popup windows, but once you have the errors in the browser, you can notify the user in any manner you feel is appropriate.
Using the same callback from multiple callers?
You can leverage the same callback function on the client for multiple web service calls. This allows you to avoid having to write a client function for each callback. In order to differentiate the calls, you pass a user context object that contains information that can be used to tell the requests apart. The user context object can be any JavaScript primitive type, array, or object.
?
For example, let's say you have a web service that contains a web method that you need to call multiple times from the client. You need to know which response corresponds to each call. For example, the first call's return value is placed in Span1 and the second call is in Span2. In order to do this, you can associate context information with the request and you can use the context information to distinguish which request is providing the response. This information is not passed to the server by default. If you want to pass this information to the web service, you would need to pass it as an input parameter to the remote method.
?
On the server, you have the following web service method that is taking in the a string which should be a stock symbol and returning a string:
?
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[Microsoft.Web.Script.Services.ScriptService]
public class Parts : System.Web.Services.WebService
{
[WebMethod]
public string UserContextSample(string stockSymbol)
{
string returnValue = String.Empty;
//do work here to look up stock symbol info
return returnValue;
}
}
?
On the client, you create a JavaScript object to store context specific information and pass that as the last parameter to the web service call. In the sample below, we're creating a dictionary object on the client with a key of contextKey and a value of a stock quote. The syntax for the web service call is:
?
WebService.Method(InputParams, CallBackMethod, ErrorMethod, contextInfo);
?
function CallServicesTest()
{
var userContext1 = {contextKey:"MSFT"};
Parts.UserContextSample("MSFT", OnCallBack, OnError, userContext1);
var userContext2 = {contextKey:"AAPL"};
Parts.UserContextSample("AAPL", OnCallBack, OnError, userContext2);
}
In the callback function, you add a second input parameter that contains the context passed in the web service call. This way you get the results of the web service call in the first input parameter and the context information in the second parameter. In this case, we're checking the context information and inserting text into specific spans on the page along with the response from the web service.
?
function OnCallBack(results, userContext)
{
switch(userContext.contextKey)
{
case "MSFT":
SPAN1.innerHTML = "Microsoft " + results;
break;
case "AAPL":
SPAN2.innerHTML = "Apple " + results;
break;
}
}
Using the same callback for different web methods?
This scenario is similar to using the same callback for multiple calls with the exception that you have two separate web service methods on the client that are using the same callback method. In this scenario, you include a third input parameter on the callback function to receive the web service call that the response is associated to.
?
For example, you have two Web Methods that your function needs to call, but you want to have a single callback method. You can tell which web method is returning by accessing the optional third input parameter to the callback function.
?
On the server you have:
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[Microsoft.Web.Script.Services.ScriptService]
public class Parts : System.Web.Services.WebService
{
[WebMethod]
public string EchoString(String s)
{
return s;
}
[WebMethod]
public string AnotherEchoString(String s)
{
return s;
}
}
?
On the client you have a button that has an onclick method calling GetEcho() function in JavaScript:
?
function GetEcho()
{
Parts.EchoString("This is echo number 1", OnCallBack);
Parts.AnotherEchoString("Another echo string!", OnCallBack);
}
function OnCallBack(results, userContext, sender)
{
alert(results + "\n" + sender);
}
?
When OnCallBack runs, you will get an alert dialog with the string you passed to the web service along with Parts.EchoString or Parts.AnotherEchoString.
Passing and receiving a server type?
As mentioned previously, the AJAX networking stack will generate proxy scripts for any server type that is referenced as an input or output parameter by the web methods contained in linked web services. This allows a developer to access these types on the client in a similar fashion as they would on the server. The types are serialized using JSON serialization which is covered in the next lesson.
?
For example, let's say you have the following web service called PeopleServices. This web service has a method called NewPerson that takes in 3 parameters; 2 Person objects and 1 object of type bool. The return value is also of type Person.
?
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[Microsoft.Web.Script.Services.ScriptService]
public class PeopleServices : System.Web.Services.WebService
{
?
[WebMethod]
public Person NewPerson(Person parent1, Person parent2, bool female)
{
Person _newPerson = new Person();
//Do other work
return _newPerson;
}
}
When you add this web service to the ScriptManager, the client will make a request for the proxy script as discussed in the Proxy Generation section. The result is that the Proxy script will have the web service method as well as the properties for the Person class. The person class is defined as the following on the server:
?
public class Person
{
public string Name
{
get { return _name; }
set { _name = value; }
}
public int Age
{
get { return _age; }
set { _age = value; }
}
public int Height
{
get { return _height; }
set { _height = value; }
}
}
?
On the client, you would need to generate two objects of type Person and pass them as parameters to the web service. In the callback script, the result parameter will be of type Person. Here's a sample JavaScript function that takes the values of textboxes on the page and creates two Person objects, then calls the NewPerson object on the above web service.
?
function GetNewPerson()
{
var person1 = new Person();
var _name = document.getElementById('p1FirstName');
var _age = document.getElementById('p1Age');
var _height = document.getElementById('p1Height');
person1.Name = _name.value;
person1.Age = _age.value;
person1.Height = _height.value;
?
var person2 = new Person();
_name = document.getElementById('p2FirstName');
_age = document.getElementById('p2Age');
_height = document.getElementById('p2Height');
?
person2.Name = _name.value;
person2.Age = _age.value;
person2.Height = _height.value;
PeopleServices.NewPerson(person1, person2, true, OnCallbackGetNewPerson, OnError);
}
?
Here is a sample callback function that handles the return type from the NewPerson method. The result parameter is a Person object and you can directly access the properties. In this case NewPerson is the ID on a Div in the page.
?
function OnCallbackGetNewPerson(result)
{
var newPerson = result;
NewPerson.innerHTML = "New Person <br/>";
NewPerson.innerHTML += "Name: " + newPerson.Name + "<br />";
NewPerson.innerHTML += "Age: " + newPerson.Age + "<br />";
NewPerson.innerHTML += "Height: " + newPerson.Height + "<br />";
}
When you run pages that make these calls and check out the network traffic, you'll see the following:
Web service call is a POST to …/PeopleService.asmx/js/NewPerson. Since the request ends in /js/NewPerson, the AJAX HttpHandler will handle the request to the web service. The Content-Type of the request is application/json.
Request Body contains all the data to create the Person object on the server. The main piece is the __type parameter which tells the server what type to create:
?
{"parent1":{"__type":"Person","Name":"Name1","Age":"12","Height":"60"},"parent2":{"__type":"Person","Name":"Name2","Age":"24","Height":"72"},"female":true}
The response also has a Content-Type of application/json and has a similar body containing the __type parameter and values necessary to create the Person object on the client:
?
{"__type":"Person","Name":"Name1name2ella","Age":23,"Height":71}
?Demo is FireForgetDemo.aspx
?Wish the above can help you.

Accessing a property from a custom object

Hi all,
I am trying to mimic what I can do imperitively, in a declarative way for the purposes of a demo. I have no issue an accessing a web service that returns a custom object imperitively. For example:
function MakeTheCall()
{
DataTier.DoTheAsyncMethod(OnMethodComplete);
}
function OnMethodComplete(customer)
{
alert(customer.FirstName + " " + customer.LastName);
}

where the 'customer' is what the web service returns and is defined as something like:
public class MyCustomer
{
public string FirstName;
public string LastName;
//...and a couple of others
}

Again, imperitively, this is easy and requires little code, however declaratively is causing me issues. I can make the call but am unsure of how to extract say the 'FirstName' from the response object and place it into a textbox. Currently I having something like:
<textBox id="txtFirstName">
<bindings>
<binding id="custServiceBindingFirstName" property="text"
dataContext="custService"
dataPath="response.object"
automatic="false" />
</bindings>
</textBox>
which as you would expect, simply puts the text '[object Object]' into the text field, but I have tried a number of permutations and am unsure of how to extract the 'FirstName' property from the response.object so that the binding can put this value into the text field. I know the calls are being made fine in my delcarative code as I can see the call being made via Fiddler tool and can see the serialise properties. I am sure I am missing something simple.
Thanks in advance.You're so close :). Try changing the dataPath to "response.object.FirstName".
Atlas will basically split the data path (based on the dot), and treateach part as a property. In this case, "response" is a property ofcustService, "object" is a property of the return value ofcustService.get_response() and "FirstName" is a property of the returnvalue of custService.get_response().get_object().

That was one of the 1st things I tried but I get a javascript error saying that the 'Object doesn't support this property or method'.


Oh, I see. Interesting. When an object is serialized to JSON,properties like FirstName are really just fields. If the serializerwould actually generate "real properties" (ie. functions likeget_FirstName), and a getDescriptor implementation (to register theseproperties), then it should've worked.
I think this means you currently can't do this declaratively.

Okay, fair enough. Does that mean it probably will work in future builds? I would assume so.
Just as a FYI, the object gets serialised like so (taken from fiddler):
{"FirstName":"Joe","LastName":"Bloggs","AddressLine1":"Level 1","AddressLine2":"18 Tarmac rd","Suburb":"Scumsville","PostCode":1234,"DateOfBirth":new Date(2003,0,17,17,37,46)}
I'm pretty sure they will come up with a way that will make it possible.
If you want, you could probably hack the atlas scripts a bit to addsupport for it yourself (obviously this is not recommended). All you'dhave to do is extend this object, after it was 'deserialized', byadding a getDescriptor implementation and add the 'properties'. I couldhelp you with this, but the question is: how badly do you want to getthis working? :)

Well its not that important really, but your offer is tempting to simply learn the inner workings of Atlas better. I'll get back to you on that one Wilco. I might hack and slash at it first, then give you a shout if (when :-) ) I get stuck.

Thanks heaps for the offer.


Ralph Sommerer's post about the beautified sources may help you to read the source code.

Okay, I have given this a shot and have gone part way there. I have defined a type descriptor function, and have added a property 'FirstName' of type string to the type descriptor for my object. Next, I do a:
Web.Component.registerBaseMethod(this,'getDescriptor');

I am not sure if this is correct, in fact, I am just guessing at which 'registerBaseMethod' implementation I should be using (ie. the Web.Component one listed above or a different one).
I then register a 'getter' for the object:
o.get_FirstName = function() { return 'My Firstname Text'; };

And all this works, generates no errors, and in the declarative section of the Atlas markup, the "response.object.FirstName" now works and returns the hardcoded text I have used in the line above. My questions are:
Is my usage ofWeb.Component.registerBaseMethodcorrect? Should I be using the registerBaseMethod of a different class?
I am now not sure how to generically examine the returned serialised object for its list of properties, and determine their types, then add them into the type descriptor. I imagine there are some support routines around this but I haven't found them yet. I could write up a lengthy string parsing routine but that doesn't sound like much fun. Any direction here would be helpfull.
Thanks.
P.S. As you are probably aware, this is all in the AtlasCore.js file. Also note, this excercise is not that important, but it is heling me to familiarise myself with the Atlas libraries.

Hi,
I think your problem should be related to mine:http://forums.asp.net/1080824/ShowPost.aspx so I tried setting datapath to dot convention, as Wilco suggests, but it still doesnt work. What is interesting is that when i use dataPath like "anything.something" my controls show empty space (even in this case) instead of "undefined" word. I tried all combinations of my custom class names like _actualTO.Brn, Xdmpactualto.Brn etc etc..but no result :(
Adam


The method registerBaseMethod is part of the Function prototype (ie.all functions have this function :)). You should generally call thisfunction like:
MyComponent.registerBaseMethod(this, 'getDescriptor');
You should also do this _inside_ 'MyComponent'.
It would probably be easier to modify the JSON.deserialize implementation, to something like:
this.deserialize = function(data) {
var x = eval('(' + data +')');
return new ObjectWrapper(x);
}
[...]
Web.ObjectWrapper = function(obj) {
var _obj = obj;
for (var member in _obj) {
// Create properties for each non-function in the wrapped object.
if (typeof(_obj[member]) != "function") {
this['get_' + member] = function() {
return _obj[member];
}
this['set_' + member] = function(value) {
_obj[member] = value;
}
}
}
this.getDescriptor = function() {
var td = new Web.TypeDescriptor();
for (var member in _obj) {
if (typeof(_obj[member]) != "function") {
td.addProperty(member, Object.getType(_obj[member]));
}
}
return td;
}
}
Type.registerClass('Web.ObjectWrapper', null, Web.ITypeDescriptorProvider);
I haven't tested this, so I don't know if this would actually work. But I think something like this would work.

Okay, I have modifications as per your post above. My current code looks like this:

this.deserialize =function(data)
{
var o = eval('('+data +')');

// Previous code
// return o;

// New code.
return new Web.DeserialisedPropertyWrapper(o);
}
}


// The object that 'wraps' the returned/serialised object. This object provides a type descriptor
// that defines each property within the deserialised object. Without this, the properties are
// not available within the declarative markup sections.
Web.DeserialisedPropertyWrapper = function(obj) {
var _obj = obj;

for (var member in _obj) {
// Create properties for each non-function in the wrapped object.
if (typeof(_obj[member]) != "function") {
this['get_' + member] = function() { // getter
return _obj[member];
}
this['set_' + member] = function(value) { // setter
_obj[member] = value;
}
}
}

// Set up property descriptions in our type descriptor for the object wrapper.
this.getDescriptor = function() {

var td = new Web.TypeDescriptor();
for (var member in _obj) {
if (typeof(_obj[member]) != "function") {
td.addProperty(member, Object.getType(_obj[member]));
}
}
return td;
}
}

// Make sure our new property wrapper object is registered and available.
Type.registerClass('Web.DeserialisedPropertyWrapper', null, Web.ITypeDescriptorProvider);

It 'mostly works' however the issue is that the 'getter' always returns the value of 'DateOfBirth'. Reason is because the'DateOfBirth' is what is the last field is when setting up the functions for each getter. Subsequently, the variable'member' is set at'DateOfBirth' when the function exists. The code for each getter in each function reads'return _obj[member]' which obviously equates to'return _obj['DateOfBirth'];' (because DateOfBirth is what member last equalled).
My javascript is pretty poor and this is probably the real issue, however I need to ensure that the function that each getter uses equates to 'return _obj['FirstName']; ' or something similar, not an actual variable that is defined when the 'getter' is setup. Hope I am making sense here, but I am unsure how to achieve this in javascript.

Access User Controls in Web Service

Hello all,

We have a custom control that has many custom properties and methods. Currently this control is being loaded through the Master page and it is working just fine. Now there is a need to load this control through a web service.

Since the control needs to be loaded through a web service, the web service does not have any information on this custom control and its properties/methods. We can only load this custom control as a System.Web.UI.UserControl, and we cannot also cast this UserControl as a custom control because the web service does not know anything about this custom control.

I read this article about rendering user controls through web service by Scott Gutherie but it only talks about user control and not custom controls and custom properties and methods.

http://weblogs.asp.net/scottgu/archive/2006/10/22/Tip_2F00_Trick_3A00_-Cool-UI-Templating-Technique-to-use-with-ASP.NET-AJAX-for-non_2D00_UpdatePanel-scenarios.aspx

Does anybody have any ideas on how to access the custom control in a web service?

Thanks.

Hi,

For custom control, it's necessary to add reference to it in the web application. And instantiate it with its actual constructor.

Then, you may render it in a similar way as Scott Gutherie has shown.

Access custom server classes from Javascript

I am in the process of migrating my VS2005/Atlas app to VS2008/ASP.Net AJAX.

In the old app I could instantiate custom c# classes on the server from within javascript.

An example would be var myObj = new MM.Test();

In the new app this no longer works and throws the 'object expected' exception.

Any ideas what I need to do in order to get this to work?

You have to mark your Webservice/WebMethod with the GenerateScriptType attribute which will include the server side types that you need to create in the client. for the above you have to add the following:

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService]
[GenerateScriptType(typeof(MM.Test))]
public class MyService
{
.........................
.........................
}


Thanks for that.

Should intellisense sense then work on the members of this class?

Also, my usage is more complex than that. I have a class named Contract that has a generic collection as one of its members. You don't seem to be able to use GenerateScriptType with generic collections so how do I access the collection and its members (specifically the add method.which worked fine using VS2005/Atlas)?

public class Contract
{
public Contract();
public PeriodCollection Periods { get; set; }

}

public class PeriodCollection : Collection<Period>
{
public PeriodCollection();
public string Year { get; set; }
}


I think the intellisens should work if you are working in VS2008.

You do not have to worry about the Collection, it will be convertet to JS Array no matter it is Generic or Regular Collection.

In that case you should add more than one GenerateScriptType in your Web Service or WebMethod.

[GenerateScriptType(typeof(class1))]
[GenerateScriptType(typeof(class2))]
[GenerateScriptType(typeof(class3))]
public class MyService{
}

Hope this will help .and mark it as answer if it solves your issue.

Saturday, March 24, 2012

A tale of two ListControls

I've got two custom server controls that extend ListControl and implement IPostBackEventHandler. Both override RenderContents and both render anchor tags. Both of them use Page.ClientScript.GetPostBackClientHyperlink in order to assign a string value to each anchor which I retrieve upon postback. The only real difference between the two is that one is a horizontal list and one is a vertical list.

I've placed each control within its own webcontrol. Each webcontrol contains an UpdatePanel, and that UpdatePanel's ContentTemplate contains the server conrol I've written. Each UpdatePanel's UpdateMode is set to Conditional.

Here's where it gets weird. When I render the page and click on a hyperlink in the vertical-displaying control, a partial postback occurrs as expected. Both controls update themselves and, when the partial postback returns, both are updated properly.

When I click on a hyperlink in the horizontally-displaying control, a full postback occurrs rather than the partial postback that should have happened. I cannot for the life of me figure out why this is happening.

Again, both controls are almost exactly the same. They render exactly the same, save one places each hyperlink in a div so they are arranged vertically rather than horizontally.

I've placed a button within the horizontally-displaying control's UpdatePanel and when I click on the button a partial postback occurrs as is expected. Still, clicking on one of the hyperlinks within the same UpdatePanel causes a full postback.

I don't even know where to start looking to find out why the full postback is occurring rather than a partial postback. Any help at this point will be greatly appreciated.

Funny how you figure out exactly what was going on right after you post your question...

The problem was that my web control's ID was "crumbs", but I was wrapping my anchor tags within a DIV with a different ID. The postback javascript was prepending that div's ID to the __DoPostBack argument, confusing the update panel. The control layout looked like this:

DIV id="crumbs_updatePanel" (the UpdatePanel's containing DIV)

DIV id="breadCrumbs" (this is where I was screwing up)

A href="http://links.10026.com/?link=javascript:__doPostBack('breadCrumbs$breadCrumbBar','')" (the UpdatePanel was confused by the div id before the $)

By making sure the containing DIV had the same ID as the web control, I made sure that the postback hyperlink had the correct div ID so that the UpdatePanel recognized it.

DIV id="crumbs_updatePanel" (the UpdatePanel's containing DIV)

DIV id="crumbs" (the containing div now has the correct ID)

A href="http://links.10026.com/?link=javascript:__doPostBack('crumbs$breadCrumbBar','')" (the UpdatePanel now recognizes this postback as coming from within itself, and does a partial postback.)

More information on this issue here: http://forums.asp.net/thread/1488508.aspx