Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to start serverside code using client side javascript

Posted on 2009-05-15
5
Medium Priority
?
558 Views
Last Modified: 2012-05-07
Hi Experts,
I have a combobox and use javascript to adjust the behavior. One of the events I use is OnClientDropDownClosed. However next to starting javascript to adjust the behaviour I need the same event or a later event to start a sub server side. What is the best approach to this?

Best regards, MB
0
Comment
Question by:mark_norge
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 

Author Comment

by:mark_norge
ID: 24396267
Below the current code

<telerik:RadComboBox ID="cboVessels"
                    Runat="server"
                    AutoPostBack="True"
                    OnClientDropDownClosed="onDropDownClosing"
                    HighlightTemplatedItems="True">
                    <ItemTemplate>
                        <div onclick="StopPropagation(event)">
                            <asp:CheckBox runat="server" ID="CheckBox"/>
                            <asp:Label ID="Label" runat="server"
                                AssociatedControlID="CheckBox"
                                Text ='<%# DataBinder.Eval(Container.DataItem, "VesselName") %>'>
                            </asp:Label>
                        </div>
                    </ItemTemplate>
                </telerik:RadComboBox>


<script type="text/javascript">
            var cancelDropDownClosing = false;
           
            function StopPropagation(e)
            {
                //cancel bubbling
                e.cancelBubble = true;
                if (e.stopPropagation)
                {
                    e.stopPropagation();
                }
            }

            function onDropDownClosing()
            {
                cancelDropDownClosing = false;
            }
        </script>
    </telerik:RadCodeBlock>
0
 
LVL 18

Expert Comment

by:carlnorrbom
ID: 24398068

Hi,

[aspx page]
<img src="" onclick=<%# RunFunction(this) %>>

[code behind]
public string RunFunction()
{
    return "something";
}
0
 
LVL 18

Accepted Solution

by:
carlnorrbom earned 1500 total points
ID: 24398100
Hi,

I meant to write in the above post that I know that this type of implementation usually works, which means you should be able to declare it likewise in the properties of the RadComboBox, i.e.:

[apsx page]
OnClientDropDownClosed=<%# onDropDownClosing %>

[code behind]
public void onDropDownClosing(object sender, eventargs e) {
    //logic to do something.
}

I think your code-behind function must be declared as public (protected might work??).

/Carl.
0
 

Author Comment

by:mark_norge
ID: 24398914
Thanks for your reply Carl,

If I read your answer correctly the suggestion is to start the server side sub on an event.

However the problem is that I am able to start a server side sub and also to start javascript on the event OnClientDropDownClosed. However I am not able to do both on the same event and this is what I need.
So possible solutions I see are:
1. Start the server side sub from client side javascript (however this does not seem to be easy / possible if I read other posts).
2. Start the server side sub and perform javascript or comparable code server side.

Regards, MB
0
 

Author Closing Comment

by:mark_norge
ID: 31581945
I was able to do what I wanted using __doPostBack. But thanks for helping me getting into the right direction.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question