A
amit
Hi.
I want to implement a right click context menu using Atlas for a web
app.
The page will list some usernames.
Right clicking on a username needs to send the user name to a
webservice, which then returns a list of available options for that
user to be displayed in the right click menu.
Selecting the option in the menu then needs to process another web
method on the selected user..
How can this be done?
So far, I have managed to send data to the webservice doing something
like this..
//---- Div containing the popup menu
<atlas:UpdatePanel ID="popupPanel" runat="server">
<ContentTemplate>
<div id="menu" class="menu" display:none>
<asp:Label ID="popupLabel" runat="server" /><br />
<asp:Button ID="Button3" runat="server" Text="opt1"
OnClick="Button3_Click" />
<asp:Button ID="Button4" runat="server" Text="opt2"
OnClick="Button4_Click" />
<asp:Button ID="Button5" runat="server" Text="opt3"
OnClick="Button5_Click" />
</div>
</ContentTemplate>
<Triggers>
<atlas:ControlEventTrigger ControlID="Button3"
EventName="Click" />
<atlas:ControlEventTrigger ControlID="Button4"
EventName="Click" />
<atlas:ControlEventTrigger ControlID="Button5"
EventName="Click" />
</Triggers>
</atlas:UpdatePanel>
//---- Asp label in repeater item to display user
name----------------------------------------
<asp:Label ID="userLabel" runat="server" Text="ADesai"
oncontextmenu="return RightClick('ADesai');return " />
//---- JS Function to send data to
Webservice----------------------------------------
function RightClick(username)
{
//Call script proxy passing the input element data
requestSimpleService =
AtlasTest.Service.UserRightClick.GetUserOptions(
username, //params
OnComplete, //Complete event
OnTimeout //Timeout event
);
return false;
}
//----JS Function to receive data from webservice
function OnComplete(result)
{
//Show context menu
ShowPopup();
popuplabel = document.getElementById("popupLabel").innerHTML =
result
}
This code currently sends the username to the webservice which at the
moment just echos it back. The OnComplete function then gets the
response from the webservice and displays it in the popup menu.
What I now need to be able to do is.. when one of the ASP:Buttons are
clicked in the panel, i need the username to be sent to the server so I
can access it from the onclick event in the code behind, and process
the selected option for the user.
Currently because I am changing the value of the label client side via
javascript, when the onclick event fires server side, it doesnt know of
this value.
What is the correct way of communicating between webcontrols and atlas
scripts?
Is there a better way to consume the response from a webservice server
side in the code behind page if it was fired via javascript?
Thanks
Amit
I want to implement a right click context menu using Atlas for a web
app.
The page will list some usernames.
Right clicking on a username needs to send the user name to a
webservice, which then returns a list of available options for that
user to be displayed in the right click menu.
Selecting the option in the menu then needs to process another web
method on the selected user..
How can this be done?
So far, I have managed to send data to the webservice doing something
like this..
//---- Div containing the popup menu
<atlas:UpdatePanel ID="popupPanel" runat="server">
<ContentTemplate>
<div id="menu" class="menu" display:none>
<asp:Label ID="popupLabel" runat="server" /><br />
<asp:Button ID="Button3" runat="server" Text="opt1"
OnClick="Button3_Click" />
<asp:Button ID="Button4" runat="server" Text="opt2"
OnClick="Button4_Click" />
<asp:Button ID="Button5" runat="server" Text="opt3"
OnClick="Button5_Click" />
</div>
</ContentTemplate>
<Triggers>
<atlas:ControlEventTrigger ControlID="Button3"
EventName="Click" />
<atlas:ControlEventTrigger ControlID="Button4"
EventName="Click" />
<atlas:ControlEventTrigger ControlID="Button5"
EventName="Click" />
</Triggers>
</atlas:UpdatePanel>
//---- Asp label in repeater item to display user
name----------------------------------------
<asp:Label ID="userLabel" runat="server" Text="ADesai"
oncontextmenu="return RightClick('ADesai');return " />
//---- JS Function to send data to
Webservice----------------------------------------
function RightClick(username)
{
//Call script proxy passing the input element data
requestSimpleService =
AtlasTest.Service.UserRightClick.GetUserOptions(
username, //params
OnComplete, //Complete event
OnTimeout //Timeout event
);
return false;
}
//----JS Function to receive data from webservice
function OnComplete(result)
{
//Show context menu
ShowPopup();
popuplabel = document.getElementById("popupLabel").innerHTML =
result
}
This code currently sends the username to the webservice which at the
moment just echos it back. The OnComplete function then gets the
response from the webservice and displays it in the popup menu.
What I now need to be able to do is.. when one of the ASP:Buttons are
clicked in the panel, i need the username to be sent to the server so I
can access it from the onclick event in the code behind, and process
the selected option for the user.
Currently because I am changing the value of the label client side via
javascript, when the onclick event fires server side, it doesnt know of
this value.
What is the correct way of communicating between webcontrols and atlas
scripts?
Is there a better way to consume the response from a webservice server
side in the code behind page if it was fired via javascript?
Thanks
Amit