Welcome Guest Search | Active Topics | Sign In | Register

ClientSideOnItemSelected howto? Options
Macoofer
Posted: Friday, April 20, 2012 8:04:01 AM
Rank: Newbie
Groups: Member

Joined: 4/20/2012
Posts: 3
Hello,

I am pretty new to EO and also pretty new to the programming in VWD 2010 and I'm stuck as I can't seem to figure out a certain part.

I put a Grid on a website and managed to fill it with a dataset that i call from a Mysql database.
I also managed to show me the selected index and with that the according values of any field in some textboxes, but only after i click on a button.
I would like this info in the textboxes to change just by clicking on a different row (I have set the FullRowMode to True)

I read some articles on how to proceed and they refer me to the part where I have to call the ClientSideOnItemSelected function in my ASPX code.

And this is where nothing happens...
I must be missing a very simple part or putting stuff in the wrong location.

Here's the part of the code where it is set:

...
Code: HTML/ASPX
<eo:Grid ID="Grid1" runat="server" BorderColor="#7F9DB9" BorderWidth="1px" 

                        ColumnHeaderAscImage="00050104" ColumnHeaderDescImage="00050105" 
                        ColumnHeaderDividerImage="00050103" 
                        FixedColumnCount="1" Font-Bold="False" Font-Italic="False" Font-Names="Tahoma" 
                        Font-Overline="False" Font-Size="8.75pt" Font-Strikeout="False" 
                        Font-Underline="False" GridLineColor="220, 223, 228" GridLines="Both" 
                        Height="200px" Width="499px" GoToBoxVisible="True" KeyField="ID" 
                        SelectedItemIndex="0" ClientSideOnItemSelected="on_item_click">
                        <ItemStyles>
                            <eo:GridItemStyleSet>
...


And this is the javascript function and it's location:

....
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<h2>
administration
</h2>
Code: Visual Basic.NET
[b]<script language="javascript" type="text/javascript">
    function on_item_click(e, info) {
        window.alert("item '" + info.getItem().getText() + "' clicked!");
    }
</script>[/b]


(The script is just a test to get anything on the screen...)

<table style="width:100%;">
<tr>
<td class="style1">
<asp:Label ID="Label1" runat="server" Text="Logged in as:"></asp:Label>
</td>
<td class="style2">
<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
</td>
<td>
<asp:Label ID="Label3" runat="server" Text="Participants:"></asp:Label>
</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td class="style1">
&nbsp;</td>
<td class="style2">

<eo:Grid ID="Grid1" runat="server" BorderColor="#7F9DB9" BorderWidth="1px"

ColumnHeaderAscImage="00050104" ColumnHeaderDescImage="00050105"
ColumnHeaderDividerImage="00050103"
FixedColumnCount="1" Font-Bold="False" Font-Italic="False" Font-Names="Tahoma"
Font-Overline="False" Font-Size="8.75pt" Font-Strikeout="False"
Font-Underline="False" GridLineColor="220, 223, 228" GridLines="Both"
Height="200px" Width="499px" GoToBoxVisible="True" KeyField="ID"
SelectedItemIndex="0" ClientSideOnItemSelected="on_item_click">
<ItemStyles>
<eo:GridItemStyleSet>
....

All I really need is a way to activate a Sub that refreshes the textboxes. As there is no normal:

SelectedIndexChanged Handler

The links that were provided in other posts only showed the demo's in which it DID work, not how it works..

Please help
Thanks in advance.

eo_support
Posted: Friday, April 20, 2012 9:02:02 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Hi,

You are mixing up the Grid's ClientSideOnItemSelected with the sample code you see the Menu control's item click event handler. These are two different handlers and they have different signature. This is the handler signature for ClientSideOnItemSelected:

http://www.essentialobjects.com/doc/1/jsdoc.public.handlers.clientside_generic_handler.aspx

The only parameter passed to you is the "sender", which is the client side Grid object:

http://www.essentialobjects.com/doc/1/jsdoc.public.grid.aspx

Inside your handler you would use methods on the Grid object to get additional information. For example, you would use this function to get the selected item:

http://www.essentialobjects.com/doc/1/jsdoc.public.grid.getselecteditem.aspx

Hope this helps. Please feel free to let us know if you have any more questions.

Thanks!
Macoofer
Posted: Saturday, April 21, 2012 5:44:20 AM
Rank: Newbie
Groups: Member

Joined: 4/20/2012
Posts: 3
Thank you for the quick reply.
I looked through the demo source code that came along with the demo pack and managed to figure out some more. Now I just need need to figure out how to get my program to run a certain Sub after the ClientSideOnItemSelected, but that's just a lack of knowledge so far

The problem is solved Angel


eo_support wrote:
Hi,

You are mixing up the Grid's ClientSideOnItemSelected with the sample code you see the Menu control's item click event handler. These are two different handlers and they have different signature. This is the handler signature for ClientSideOnItemSelected:

http://www.essentialobjects.com/doc/1/jsdoc.public.handlers.clientside_generic_handler.aspx

The only parameter passed to you is the "sender", which is the client side Grid object:

http://www.essentialobjects.com/doc/1/jsdoc.public.grid.aspx

Inside your handler you would use methods on the Grid object to get additional information. For example, you would use this function to get the selected item:

http://www.essentialobjects.com/doc/1/jsdoc.public.grid.getselecteditem.aspx

Hope this helps. Please feel free to let us know if you have any more questions.

Thanks!
eo_support
Posted: Saturday, April 21, 2012 8:48:33 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Hi,

This is something else. You are basically asking a very generic question of "how to trigger a server side event from client side JavaScript". There are various ways to do that but none particular has anything to do with the Grid. You can search online and you should be able to find plenty of information about this. You can also take a look of the documentation of our ScriptEvent control to see how to do this. ScriptEvent is a free control that is designed to do just that.

Thanks!
Macoofer
Posted: Saturday, April 21, 2012 8:54:57 AM
Rank: Newbie
Groups: Member

Joined: 4/20/2012
Posts: 3
Found it, thanks for pointing me into that direction, I hadn't seen it yet. I will play around with that. There's more in the EO package than I had discovered so far.
Time to save up some money and buy the license and start making some real nice things!
eo_support
Posted: Saturday, April 21, 2012 9:06:21 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Yes. It's a big package. : ) Let us know if you have any other questions.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.