Showing posts with label webservice. Show all posts
Showing posts with label webservice. Show all posts

Wednesday, March 28, 2012

Links dont work properly in a working Modal Popup

Is it possible to have client side <a href links inside an extender?

I've got a Modal Popup working. A webservice is invoke via javascript on the client. The webservice queries a database and returns html to the javascript which inserts the markup into the Modal Popup panel. The popup works well, displaying a title, a description and an image. It also displays a <a href link, however this link doesn't work as intended. It displays as a link but when clicked goes nowhere. I've tried it with and without target="_blank". The only way make it function is by right clicking on it and Opening in a new tab or in a new window. Any advice would be very welcome as I'm stuck and it's far from user friendly in it's current state.

Hi oscar,

Do you got some code that replicates the error?

Kind regards,
Wim


Hello,

What is resulting output of the link?

Thanks,

Louis


Thanks both for taking the time to help out. I tried logging in to reply, entered my password incorrectly once and my user account has now been locked out, despite it letting me reset my password.

I've now got this working.

The web service returns a string containing all of the markup to be displayed in the panel:

strdetails += "<a href="http://links.10026.com/?link="""onClick=""javascript:popUp('"
strdetails += ds.Tables(0).Rows(0)("livemaplink").ToString()
strdetails += "')"">Live Map</a>"

then with the rest of the javascript functions in the aspx page is this:

function popUp(URL)

{window.open(URL);}

I'd tried adding the popup function to the panel in the strdetails string and it didn't work but this does.

Thanks again.


Hi oscar Version 2Stick out tongue

Glad you got it to work!

Euhm, Even if none of our answer are actually solutions, I think you can still mark the thread as solved, somewhere on top, or mark your reply as answer. Because this thread is resolved ;)

Kind regards,
Wim


Will do, when my original account is unlocked that is!Big Smile

Cheers.


Will do, when my original account is unlocked that is!Big Smile

Cheers.

Monday, March 26, 2012

Listening to a CascadingDropDown event. How?

Is there any way to call client-side javascript when the CascadingDropDown has successfully finished its population from a webservice? Please give a code sample.

The solution and code sample is availablehere (provided bychrispont. Thanks,chrispont!).

Listview datasource only one webservice

i use listviews to show data in the page.its datasource is bound to a webservice.But i want to use more listviews so i have to write more webservice for each one.I want to write only one webservice and call its methods.. Doesnt Listview's datasource let call webservice methods instead of webservice itself?Do i have to write the code below for each webservice class?How can i call methods in only one webservice?

[DataObjectMethod(DataObjectMethodType.Select)]

public LOGTEN.functionClass.ProductListRow[] SelectRows()

{

returnSampleDataService2.Data.ToArray();

}

Starting in the March CTP, you can have more than one select method on a data service. There is a new loadMethod property on DataSource that enables you to specify which method you want to use.

Can you give me a litte sample code part?How can i declare its methods?i think , i have to declare one default select method?

Thanks..


Sure, here's something from our unit tests:

[

DataObjectMethod(DataObjectMethodType.Select,true)]publicList<SampleRow> SelectRows() {return Data;

}

[

DataObjectMethod(DataObjectMethodType.Select)]publicList<SampleRow> SelectRowsByFirstLetters(string firstLetters) {List<SampleRow> result =newList<SampleRow>();foreach (SampleRow rowin Data) {if (row.Name.StartsWith(firstLetters)) {

result.Add(row);

}

}

return result;

}

Saturday, March 24, 2012

Listview passing parameters problem

I use Listview by declaretive method and bind a method of webservice to it.But i want to pass parameters to its select method so i could select data with some restriction values.How can i do this?

<components>

<dataSource id="dataSourceMV" serviceURL="MainPageWebService.asmx"autoLoad="true" loadMethod="SelectMostValuableList" />...

Thanks

Hi,

first of all I have a question: really is your service method being called, even without parameters? (see the end of my post).

The DataSource control exposes aparameters object that you can use to pass parameters to your method. To do this, you have to expand the parameters object by adding a property with theexact name of the parameter, as declared in your method signature.

For example, suppose that I want to set the myparam parameter with the value of a textbox:

<dataSource id="dataSourceMV"
serviceURL="MainPageWebService.asmx"
serviceType="Handler"
autoLoad="true"
loadMethod="SelectMostValuableList"
>
<bindings>
<binding dataContext="myTextBox"
dataPath="text"
property="parameters"
propertyKey="myparam"
direction="In"
/>
</binding>
</bindings>
</dataSource>

Notice that you have to set theserviceType attribute to "Handler" if you want to be able to call a service method, otherwise you have to use a DataService.

Ok, now the bad news: probably this example will not work at all, because there's a bug in the March CTP that makes impossible to call service methods from a DataSource control, so you'll have to use a DataService (or declare a method calledGetData in your web service, that returns structured data).


Hi,

just a precisation on my previous post (I'm unable to edit it, maybe due to a forum upgrade?): using the March CTP is not possible to call, from a DataSource control, service methods defined in classic web services (i.e. classes that inherit from the System.Web.Services.WebService class), but it is possible to call methods defined in a class that inherits from the DataService class.


I dont understand how to use in webservice code ,in below code i want to access (send) parameter1.What do i have to exactly write in listview's datasource

<components>
<dataSource id="dataSource" serviceURL="MainPageWebService.asmx" autoLoad="true" loadMethod="SelectMostValuableList" />
<listView id="dataContents" itemTemplateParentElementId="masterTemplate" propertyChanged="onChange" >
<bindings>
<binding dataContext="dataSource" dataPath="data"property="data" ></binding>
</bindings>
<layoutTemplate>
<template layoutElement="masterTemplate"/>
</layoutTemplate>
<itemTemplate>
<template layoutElement="masterItemTemplate">
<label id="masterName">
<bindings>
<binding dataPath="miktar" property="text"/>
</bindings>
</label>
</template>
</itemTemplate>
</listView>
</components>

[DataObjectMethod(DataObjectMethodType.Select)]
public BLL.Collections.EnDegerlilerAtlas[] SelectMostValuableList(string myParameter1)
{
return MainPageWebService.Data7.ToArray();
}
Hi,

where does the myParameter1 value come from? Is it a form parameter, a bound value? Knowing this I can show you the appropriate code.
i want to pass just form parameter value like <input id="Hidden1" type="hidden" value="myParameter1" /> myParameter1 value to dataService.

Hi,

since we want to set parameters declaratively, we should upgrade the hidden field to an Atlas control, but no wrapper for the hidden field is provided by the framework. At this point, you could try to use a <textBox /> control:

<textBox id="myHiddenField" />

and then declare the DataSource control in this way:

<dataSource id="dataSource"
serviceURL="MainPageWebService.asmx"
loadMethod="SelectMostValuableList"
autoLoad="true"
>

<bindings>
<binding dataContext="myHiddenField"
dataPath="text"
property="parameters"
propertyKey="myParameter1"
direction="In"
/>
</bindings>

</dataSource>

In the declaration above, the value of the hidden field is bound to the value of myParameter1.


Hi All and Garbin,

When i execute the code that Garbin has provided, I get an error:

Assertion Failed: Could not resolve reference to object named "ctl00_ContentPlaceBody_HiddenLabel" for "dataContext" property on object of type "Sys.Binding"

and my page doesn't work.

Declaration of this Label is:

<

asp:LabelID="HiddenLabel"runat="server"></asp:Label>

Xml Script:

<components>
<dataSource id = "dataSource"
serviceURL = "EventsWebService.asmx"
autoLoad = "true"
loadMethod = "GetGeneralEvents"
>
<bindings>
<binding dataContext = "ctl00_ContentPlaceBody_HiddenLabel"
dataPath = "text"
property = "parameters"
propertyKey = "ClientLogin"
direction = "In"
/>
</bindings>

The --> dataContext = "ctl00_ContentPlaceBody_HiddenLabel" <--

portion is hard coded as currently i don't know how to pass the generated control id to the XML Script.

Urgent help is HIGHLY appriciated. :)


Ok, I failed to understand "upgrade your hidden field to an Atlas Control"

so now code lOOks like this:

<

labelid="HiddenLabel"><%=CurrentClient.Login%></label>

<dataSource id = "dataSource"
serviceURL = "EventsWebService.asmx"
autoLoad = "true"
loadMethod = "GetGeneralEvents"
>
<bindings>
<binding dataContext = "HiddenLabel"
dataPath = "text"
property = "parameters"
propertyKey = "ClientLogin"
direction = "In"
/>
</bindings>
</dataSource>
.

.

.

<label id="HiddenLabel">
<bindings>
<binding property="text" dataPath="text" />
</bindings>
</label>

:( but still i have an error saying :

No data context available for binding with ID "" and dataPath "text" on object of type "Sys.UI.Label"


Hi,

ok, let's start with the last snippet you posted. The <binding /> inside the dataSource control has dataContext="HiddenLabel". This means that there must be an Atlas control with the id of "HiddenLabel". This control is declared below, but encapsulates a binding that isn't needed. Try to remove it:

<label id="HiddenLabel" />
Hi,

Sentimotive:


I failed to understand "upgrade your hidden field to an Atlas Control"


when I say "upgrading something to an Atlas control", I mean associate to a portion of static HTML (one element or a whole set of elements) an Atlas control.

For example, if you declared a textbox like

<input type="text" id="myTextBox" />
you can upgrade it to an Atlas TextBox by adding a control in the xml-script section:

<textBox id="myTextBox" />

Now, myTextBox is also an Atlas control (before, it was only a DOM element), and the element is encapsulated inside the control.
Regarding the hidden field, there isn't a specific Atlas control that wraps it. What you could do in this case is upgrade the hidden field to a TextBox and use the text property to get the hidden field's value:

<input type="hidden" id="myHiddenField" />
<textBox id="myHiddenField" />

But the above code is a sort of hack, and the best approach would be to write a specific Atlas control that wraps the hidden field element.
Hi,

btw, coding a little Atlas control that wraps an hidden field element is not difficult:

Type.registerNamespace('AtlasUI.HiddenField');

AtlasUI.HiddenField = function(associatedElement) {
AtlasUI.HiddenField.initializeBase(this, [associatedElement]);

// get/set the value.
this.get_value = function() {
return this.element.value;
}
this.set_value = function(val) {
if(val != this.element.value) {
this.element.value = val;
}
}

// Allow declarative programming against this control.
this.getDescriptor = function() {
var td = AtlasUI.HiddenField.callBaseMethod(this, 'getDescriptor');

td.addProperty('value', String);

return td;
}
}
AtlasUI.HiddenField.registerClass('AtlasUI.HiddenField', Sys.UI.Control);
Sys.TypeDescriptor.addType('script', 'hiddenField', AtlasUI.HiddenField);

Wednesday, March 21, 2012

Loading all dropdowns with cascading dropdown extender

Since the cascading dropdown extender loads all dropdowns with a webservice, is it faster to load all dropdowns with this even if cascading is not needed?

In other words, is it faster to load a large (100+) dropdown with the cascading dropdown extender than doing it on the page load?

Hi Red_bull_n_vodka,

red_bull_n_vodka:

Since the cascading dropdown extender loads all dropdowns with a webservice, is it faster to load all dropdowns with this even if cascading is not needed?

In other words, is it faster to load a large (100+) dropdown with the cascading dropdown extender than doing it on the page load?

Actually, CascadingDropDown will call its WebService as soon as it is initialized. So I don't think it will be prominent faster in your situation. To speed up the response times , I think you should pay more attention to WebService rather than the client implementation.For example, cache and connection pool etc.

I hope this help.

Best regards,

Jonathan