Relating two shield UI ASP.NET Charts - asp.net

I want to create two related Shield UI ASP.NET charts. When the users clicks on the first one, the data on the second one to be changed. I looked at the available events in my Visual Studio, however what i find are events related to the data binding, loading and so on. I also see there is a group of properties- ClientEvents. And for the SeriesClick event i declare the SeriesClickFunction. Which is located in my C# code:
protected void SeriesClickFunction() {
}
However when i run my application in debug mode and put a break on that function, it never gets triggered. Why is that? How could I actually take use of these events?

In the C# code module you may not place the ClientEvents functionality. What you need is to place it on the HTML source of your page. Here is one good example of how you may relate two charts in the manner you want:
https://demos.shieldui.com/aspnet/rangebar-chart/related-charts

Related

Unable to get current click value through Adobe Launch

I created a click event in adobe launch which will capture the value of the link and send it to analytics. I have created a data element for saving the value and in my DOM I am saving value in local storage.
Local storage code:
$('.card').click(function() {
var name = $(this).text();
localStorage.setItem('productName', name);
});
My problem is when I click the first link no value got saved, but after when I click second link it saves the value of first link and on third link saves value of second link and so on. I want to save current link value in evar3 variable.
Data element:
Rule:
Set variables:
Thanks,
Harshit
I'm scratching my head a little bit about why your jQuery selector doesn't match your Rule selector, but that's probably not immediately related or relevant, considering you said you are seeing data pop, in general, so at face value, I'm going to ignore that.
But in general, it sounds like your jQuery code is getting executed after the Rule is evaluated, so it's effectively one step behind. I'm not sure there's much if anything you can do about that if you aim to keep two separate click event listeners like this.
You're going to have to restructure to have one chain off the other (which I don't think is actually feasible with jQuery > Launch as-is. Maybe if you write two separate custom code blocks with promise chaining but that kind of sidesteps Launch and IMO is over-complicating things to begin with (see below)). Better yet, merge them into a single click event listener. On that note..
Why do you have two separate click event listeners? Is the sole reason for this to pass off the link text? Because you can reference the clicked element in the Launch Rule itself.
You should be able to reference %this.innerText% in the Set Variables fields. Or you can reference this object in custom code boxes within the Rule.
IOW at face value I don't see why you need or should be creating/using that jQuery listener or pushing to local storage like that.
Update:
You commented the following:
I tried with %this.innerText% it is also not showing current values. I
am pushing the value first to local storage because my link values are
generating on runtime through an API. They are not hardcoded. I am
also trying to figure out why my rule is getting fired before my
jquery is evaluated. But when I check in console using
_satellite.getVar('Product Name'); it shows me the correct value, but in debugger console value is wrong. Can you show me the way you want
to create rule to getting it fired correctly ? Thanks,
Okay so your link values are generated runtime through an API call? Well okay now that sounds like where the (timing) issue is, and it's the same issue in principle I mentioned you prolly had between the jQuery and Launch code. Assuming you can't change this dynamic link functionality, you have two options:
1. Explicitly trigger a launch rule (direct call rule) in a callback from the API code that's generating the link values.
This is the better method, because you won't have race condition issues with your API vs. link tracking code. The biggest caveat about this method though is that it requires requires you to actively add code to the site, which may or may not be feasible for you.
I have no idea what your code for generating the link looks like, but presumably it's some ajax call and generated from the success callback. So in the callback, you'd add a line of code something like this:
_satellite.track('product_image_click', {
text : elem.innerText
});
Again, I don't know what your API code that generates the link looks like, but presumably you have within it some element object you append to or update the DOM, so for this example, I will refer to that as elem.
'product_image_click' - This is the value you use for the direct call rule identifier in the interface, e.g. :
And then _satellite.track() call also includes an object payload in 2nd argument that you can pass to the direct call rule. So in the code above, I set a property named text and give it a value of elem.innerText.
Then, within the direct call rule, where you set variables, the data you passed can be referenced from event.details object within custom code box (e.g. event.details.text), or using % syntax within the interface fields (e.g. %event.details.text%).
2. Make use of setTimeout to delay evaluating the link click.
The one advantage of this method over option #1 is that it is passive. You don't have to add code directly to your site to make it work.
However, this is the shadier option, because you don't really know how long it will take for your link to be generated. But generally speaking, if you can determine it takes on average say 250ms for the link generation API to do its thing, and you set the timeout to be called at say 300-500ms, then you will probably be okay most of the time. However, it's never a 100% guarantee.
In addition, if clicking on the link ultimately redirects the visitor to another page, then this solution will likely not work for you at all, since the browser will almost certainly have navigated before this has a chance to execute. Because of this, I normally I wouldn't even mention this as an option, but since you mentioned this link involves an API that generates the link values when clicked, I figured maybe this isn't a navigation / redirect link, so maybe this is an option you can go for, if you can't do option #1.
First, create a direct call rule the same as shown in option #1. This will be the rule that receives the link text and makes the Adobe Analytics (or whatever other marketing tag) calls.
Then, create a separate rule as a click event, similar to what you are currently trying to do (listening for the link click, based on your css selector). In this rule, you won't be setting any AA variables. Instead, add a custom js box with code like this:
var elem = this;
(function (elem) {
window.setTimeout(function() {
_satellite.track('product_image_click', {
text : elem.innerText
});
}, 500);
})(elem);
So when the rule is triggered, it will create a setTimeout callback to call the first rule, passing the link text in the payload. And.. hopefully the 500ms timeout shown in the code example is enough time for the API to do its thing. You may be able to adjust it up or down.
Rather than defining it in Data Element I would say its better to keep it directly in the Rule itself. Please try with this %this.#text%.
Let me know if this helped.

VS2008/ASP.NET 3.5 - How to create dynamic webforms

The question in a nutshell: Is there a way to add forms dynamically to a aspx-page? I know how to add controls to an existing form, but how to add a whole form?
Bckground:
I am "forced" to work in Visual Studio 2008 and I want to create a controller, which builds a page depending from the list of elements a model gives it (e.g.: the list may contain a paragraph, an image, another paragraph, a parapgraph again, a form and so on).
This works fine for the first examples as I am able to add them to the inner-html of a div-container.
Thinking about ways to generate a form like this (innerHTML += form), I feel I'd be throwing the few possible advantages ASP I can see (compared to PHP) out of the window in terms of input validation and so on. But I can't find a way to generate a "real, server-run" form. The same goes for gridviews, but I guess the solution may be similar.
A possible workaround would be to create an empty form
<form runat="server" id="dummyForm">...
and add controls to it dynamically. The obvious(?) downside to this would be, that I couldn't change its position (at least I wouldn't know how) in relation to the other content elements.
Another downside would be that I would be limited to one form per page and that may or may not be sufficient. If it wasn't I would starting to add several empty dummy-forms and would start indexing them and all of that doesn't look very cool to me.
Is there a more elegant way to a solution?
TIA
Simon
You can't add more than once server side Form tag in single aspx file
(in run time or design time)
maybe this article help you to generate dynamic forms :
https://msdn.microsoft.com/en-us/library/aa479330.aspx

Invoking immediate save for Shield UI ASP.NET Chart

I am using Shield UI ASP.NET Charts to show registered (and logged in) users informations regarding their accounts. I went through the documentation, but can't find a solution to the following thing: is it possible to invoke an immediate save once the user clicks on the export icon?
I am enabling the save so:
<ExportOptions AllowExportToImage="true" AllowPrint="false" />
Are there any edditional parameters to be set?
There are no additional properties to be set/enabled because it is not possible to invoke an immediate save/export of the chart's image (skipping the filename and location choices).
However you may take use of the additional tooltips:
ExportTooltip="" or/and PrintTooltip=""
to provide the users some more information if needed.

Data does not show in Design Mode

I have my models, viewmodels and views setup and binding properly when the program runs, but when in design mode I do not see any of the data or dynamic elements that are controlled by the data. What could I be missing. I looked at the sample friends application and did not see anything I was doing different. Any help will be appreciated.
The design view does not support connections to your database, so if your view model constructors are loading any data from a database then this will cause an exception when switching to design view. Consequently, your UI elements will not load properly.
You will, instead, need to load dummy data if your in design mode. You can progamatically check whether or not you're in design mode by using the MVVM-Light Toolkit's ViewModelBase.IsInDesignModeStatic property.
For example:
ViewModelConstructor()
{
if (ViewModelBase.IsInDesignModeStatic)
{
// load dummy data
}
else
{
// load real data from database
}
}
Usually you need to DEBUG why design data is not shown. In most cases, it is because exceptions are thrown somewhere in your code when the designer is executing them. As mentioned by Laurent in his videos, one way is to attach to your Blend process in Visual Studio. I tried this approach in my project and it worked perfectly.

Does an mx:Window component have it's own applicationComplete?

I'm working on an app that, from the Main.mxml, opens one or many Window.mxml instances. When it's done I want all windows to be chromeless so the custom controls need to work.
In Main I've added applicationComplete="init();" so the init function gets ran, which contains clickhandlers, which makes the buttons work.
However, this way of running an init function doesn't seem to be valid for an mx:Window.
I can cheat by not using a clickhandler for the minimize and close buttons with a click="this.minimize();", but I don't know of a way like this to make the move work because it's a MOUSE_DOWN event.
Question 1:
Is there a way to have such an init function in an mx:Window?
Question 2:
What's a good way to make the buttons on the Window instances all work?
ps. If you think question 2 needs a separate post please let me know, they're so closely related and seemingly simple I couldn't decide.
Example code:
Main.mxml - http://pastebin.com/0HHVpkb8
Window.mxml - http://pastebin.com/g5TWuLYk
Window doesn't have an applicationComplete event, but it does have windowComplete event. Perhaps that would work for you. There is a list if Window events here.

Resources