This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

Problem with rubberband not found on postbacks/ajax actions

Hi

I have integrated your code in a large solution. The code compiles fine but ajax actions do nothing and postbacks return ControlNotFound exceptions. Se code below (which should look familar as it is taken more or less directly from your examples):

			                        <td>
					                    <input id="ButtonCrop" onclick="Crop();" type="image" src="Images\ImageEditor\crop.jpg" /> &nbsp;
					                    <input id="ButtonRotateRight" onclick="RotateRight();" type="image" src="Images\ImageEditor\right.jpg" /> &nbsp;
					                    <input id="ButtonRotateLeft" onclick="RotateLeft();" type="image" src="Images\ImageEditor\left.jpg" /> &nbsp;
					                    <input id="ButtonBrightnessUp" onclick="BrightnessUp();" type="image" src="Images\ImageEditor\light.jpg" /> &nbsp;
					                    <input id="ButtonBrightnessDown" onclick="BrightnessDown();" type="image" src="Images\ImageEditor\dark.jpg" />
			                        </td>
		                        </tr>
			                    <tr>
				                    <td valign="top">
					                    <aur:BitmapViewer ID="viewer" runat="server" Width="344px" Height="270px" ImageLoadMode="AdaptiveTile" Rubberband="RectangleRubberband1"
						                    ZoomMode="BestFitShrinkOnly" ViewportAlignment="CenterCenter" BorderWidth="2" BorderStyle="Inset" ScrollBarsStyle="Auto" BackColor="White"> 
					                    </aur:BitmapViewer>
				                    </td>
				                    <td>
					                    &nbsp;
				                    </td>
				                    <td valign="top" width="100">
					                    <span id="SpanWarning" style="display: none; font-weight: bold; color: red">Selected
						                    area is too small to get good quality of prints. </span>
					                    <asp:CustomValidator ID="imageValidation" runat="server"></asp:CustomValidator>
				                    </td>
				                    <td>
				                        <asp:Button ID="OK" runat="server" OnCommand="UploadImage" Text="Gem" />
				                    </td>
			                    </tr>
		                    </table>
		                    <aur:RectangleRubberband ID="RectangleRubberband1" runat="server" ResizeMode="Proportional" GripsVisible="True" MaskVisible="True" />
		                    <script type="text/javascript">
			                    Sys.Application.add_load(Application_load);
		                    </script>


exception message is: Can't locate rubberband with ClientID equals 'RectangleRubberband1'.

The solution also contains other ajax components, can this be an issue?

Regards
<stefan>
More details: the problems seem to start in this javascript method Sys$WebForms$PageRequestManager$_onFormSubmit

In line 764, this call fails if (!this._postBackSettings.async) {, as postBackSettings is null.....
Even though I pass 'viewer.invokeRemo....' in the javascript code shown below the .cs code is never reached

function Crop(){
	if (viewer.get_status() != GraphicsMill.UpdateStatus.busy) {
		//Process cropping via remote scripting
		var r = rectangleRubberband.get_rectangle();
		if (r.width < 1 || r.height < 1) {
			return;
		}
	
		viewer.invokeRemoteMethod("Crop", [r.x, r.y, r.width, r.height]);	

		updateRectangle=true;
	}
	else {
		alert("Please wait until previous operation will be completed.");
	}
}
Hello, Stefan.

We confirm the problem. To get rid of this error you should move your BitmapViewer and RectangleRubberband to the root form tag of your page.

If this solution is not suitable for you please submit case.
Thank you, I have come to the same conclusion and this works just fine for me.

The funny part is that IE7 does not fail on ajax actions but FireFox 2 (and Safari 3) do.

Regards
Hi

I have the same problem again.

We have av new framework that creates most of a page during preinit adding controls programatically. There is nothing in the .aspx file itself.

Again I get "Can't locate rubberband with ClientID equals 'rectangleRubberband'." during postbacks or ajax interactions....

Preinit occurs before the exceptions is thrown so the page structure should be present. Looking at the html confirms a control with that name is indeed present on the page.....

Please advise ;->

Stack trace is this:

[ControlNotFoundException: Can't locate rubberband with ClientID equals 'rectangleRubberband'.]
Aurigma.GraphicsMill.AjaxControls.BaseViewer.LoadPostData(String postDataKey, NameValueCollection postCollection) +855
Aurigma.GraphicsMill.AjaxControls.BitmapViewer.LoadPostData(String postDataKey, NameValueCollection postCollection) +67
Aurigma.GraphicsMill.AjaxControls.BaseViewer.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +36
System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +661
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1194

Best regards
<stefan>
Hello Stefan,

Please, could you create support case for this issue and attach small code sample to reproduce the issue?