Using viewer in user control & Ajax

Not sure if this is a bug or just an oddity… This is for asp.net web forms using the ajax feature.

When using the doconut control inside a user control and then calling ctlDoc.GetAjaxInitArguements, the resulting value returns the object name which also includes the name of the usercontrol. Below, instead of it returning “objctlDoc” which is the name of the doconut control, it returns “objDocView_ctlDoc” whereas “DocView” is the name of the user control. Below is the string returned from GetAjaxInitArguements:

$(’#div_DocView_ctlDoc’).css(‘height’,‘100%’); objDocView_ctlDoc = $(’#div_DocView_ctlDoc’).docViewer({showThumbs:true,autoFocus:false,autoPageFocus:false,pageZoom:100,zoomStep:10,maxZoom:200,format:‘png’, FitType:‘width’, debugMode:true, showToolTip: true, cacheEnabled: false, autoLoad: false, toolTipPageText:‘Page ‘, BasePath:’’, ResPath:’’, fixedZoom:true, fixedZoomPercent: 100, fixedZoomPercentMobile: 75, showHyperlinks:true, largeDoc:true});

In the provided example, the JS variable name is set to ‘objctlDoc’, but since the returned variable name was ‘objDocView_ctlDoc’, the object variable isn’t populated properly.

To work around this, I had to dynamically create the variable name in the code-behind:

private void DocView_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
string scriptJs = “var obj” + ctlDoc.ClientID + “; " + ctlDoc.GetAjaxInitArguments(”");
Page.ClientScript.RegisterStartupScript(this.GetType(), “docAjaxView”, scriptJs, true);
}
}

and on the frontpage, dynamically assign the object name to the button

<input type=“button” value=“Zoom In” onclick=“obj<%=ctlDoc.Clientid %>.Zoom(true);” />

It’s possible there’s some other way to accomplish this…

@RJT,

Would it be possible to attach a small example of your project? This way, we can accurately replicate the issue and collaborate with the development team to find a solution.