Welcome Guest Search | Active Topics | Sign In | Register

Cannot get grid select row to fire event on server side Options
Uncork
Posted: Sunday, July 31, 2011 7:44:37 AM
Rank: Member
Groups: Member

Joined: 7/13/2011
Posts: 13
I cannot get grid select row to fire event on server side


I have tried to follow the demo (on the web, as the one installed on my pc will not run), but selecting a row is not reaching the serverside code.

Thanks

Here is my test aspx
===============
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="TheUncorkedCellar.Test" %>

<%@ Register Assembly="EO.Web" Namespace="EO.Web" TagPrefix="eo" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Test Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<script language="javascript" type="text/javascript">
function OnItemSelected(grid)
{
//Get the selected item
var item = grid.getSelectedItem();

//Raises server side ItemCommand event.
//The first parameter is the item index.
//The second parameter is an additional
//value that you pass to the server side.
//This value is not used by the Grid
grid.raiseItemCommandEvent(item.getIndex(), "select");
}
</script>

<asp:Label ID="LabelDebugInfo" runat="server" Text="Label Debug Info"></asp:Label>

<br /><br />

<eo:Grid ID="TestEOGrid" runat="server" BorderColor="#828790" BorderWidth="1px"
ColumnHeaderAscImage="00050204" ColumnHeaderDescImage="00050205"
ColumnHeaderDividerImage="00050203" ColumnHeaderHeight="24"
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="240, 240, 240" GridLines="Both"
Height="200px" ItemHeight="19" Width="380px"
ClientSideOnItemSelected="OnItemSelected"
>
<FooterStyle CssText="padding-bottom:4px;padding-left:4px;padding-right:4px;padding-top:4px;" />
<columntemplates>
<eo:TextBoxColumn>
<TextBoxStyle CssText="BORDER-RIGHT: #7f9db9 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #7f9db9 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 8.75pt; PADDING-BOTTOM: 1px; MARGIN: 0px; BORDER-LEFT: #7f9db9 1px solid; PADDING-TOP: 2px; BORDER-BOTTOM: #7f9db9 1px solid; FONT-FAMILY: Tahoma" />
</eo:TextBoxColumn>
<eo:DateTimeColumn>
<datepicker controlskinid="None" daycellheight="16" daycellwidth="19"
dayheaderformat="FirstLetter" disableddates="" othermonthdayvisible="True"
selecteddates="" titleleftarrowimageurl="DefaultSubMenuIconRTL"
titlerightarrowimageurl="DefaultSubMenuIcon">
<todaystyle csstext="font-family: tahoma; font-size: 12px; border-right: #bb5503 1px solid; border-top: #bb5503 1px solid; border-left: #bb5503 1px solid; border-bottom: #bb5503 1px solid" />
<SelectedDayStyle CssText="font-family: tahoma; font-size: 12px; background-color: #fbe694; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
<disableddaystyle csstext="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
<pickerstyle csstext="border-bottom-color:#7f9db9;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#7f9db9;border-left-style:solid;border-left-width:1px;border-right-color:#7f9db9;border-right-style:solid;border-right-width:1px;border-top-color:#7f9db9;border-top-style:solid;border-top-width:1px;font-family:Courier New;font-size:8pt;margin-bottom:0px;margin-left:0px;margin-right:0px;margin-top:0px;padding-bottom:1px;padding-left:2px;padding-right:2px;padding-top:2px;" />
<calendarstyle csstext="background-color: white; border-right: #7f9db9 1px solid; padding-right: 4px; border-top: #7f9db9 1px solid; padding-left: 4px; font-size: 9px; padding-bottom: 4px; border-left: #7f9db9 1px solid; padding-top: 4px; border-bottom: #7f9db9 1px solid; font-family: tahoma" />
<titlearrowstyle csstext="cursor:hand" />
<dayhoverstyle csstext="font-family: tahoma; font-size: 12px; border-right: #fbe694 1px solid; border-top: #fbe694 1px solid; border-left: #fbe694 1px solid; border-bottom: #fbe694 1px solid" />
<monthstyle csstext="font-family: tahoma; font-size: 12px; margin-left: 14px; cursor: hand; margin-right: 14px" />
<TitleStyle CssText="background-color:#9ebef5;font-family:Tahoma;font-size:12px;padding-bottom:2px;padding-left:6px;padding-right:6px;padding-top:2px;" />
<OtherMonthDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
<DayHeaderStyle CssText="font-family: tahoma; font-size: 12px; border-bottom: #aca899 1px solid" />
<DayStyle CssText="font-family: tahoma; font-size: 12px; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
</datepicker>
</eo:DateTimeColumn>
<eo:MaskedEditColumn>
<maskededit controlskinid="None"
textboxstyle-csstext="BORDER-RIGHT: #7f9db9 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #7f9db9 1px solid; PADDING-LEFT: 2px; PADDING-BOTTOM: 1px; MARGIN: 0px; BORDER-LEFT: #7f9db9 1px solid; PADDING-TOP: 2px; BORDER-BOTTOM: #7f9db9 1px solid; font-family:Courier New;font-size:8pt;">
</maskededit>
</eo:MaskedEditColumn>
</columntemplates>
<columnheaderstyle csstext="background-image:url('00050201');padding-left:8px;padding-top:4px;" />
<itemstyles>
<eo:GridItemStyleSet>
<ItemStyle CssText="background-color: white" />
<ItemHoverStyle CssText="background-image: url(00050206); background-repeat: repeat-x" />
<SelectedStyle CssText="background-image: url(00050207); background-repeat: repeat-x" />
<cellstyle csstext="padding-left:8px;padding-top:2px;white-space:nowrap;" />
</eo:GridItemStyleSet>
</itemstyles>
<ColumnHeaderHoverStyle CssText="background-image:url('00050202');padding-left:8px;padding-top:4px;" />
<Columns>
<eo:RowNumberColumn Width="50">
</eo:RowNumberColumn>
<eo:StaticColumn HeaderText="Field 1" DataField="Field1">
</eo:StaticColumn>
<eo:StaticColumn HeaderText="Field 2" DataField="Field2">
</eo:StaticColumn>
</Columns>
</eo:Grid>


</div>
</form>
</body>
</html>

==================
Here is my test codebehind

==================
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace TheUncorkedCellar
{
public partial class Test : System.Web.UI.Page
{
public static IDataReader TestReader;

public static int Load_TestEOList()
{
TestReader = TestListReader.GetReader();
return TestReader.RecordsAffected;
;
}

protected void Page_Load(object sender, EventArgs e)
{
int iRecordCount;

iRecordCount = Load_TestEOList();
TestEOGrid.DataSource = TestReader;
TestEOGrid.RecordCount = iRecordCount;
TestEOGrid.DataBind();
}


protected void TestEOGrid_ItemCommand(object sender, EO.Web.GridCommandEventArgs e)
{
//Check whether it is from our client side
//JavaScript call
if (e.CommandName == "select")
{
string s = string.Empty;
s += "Row Index:" + e.Item.Index.ToString();
s += "<br />1:" + e.Item.Cells[1].Value.ToString();
s += "<br />2:" + e.Item.Cells[2].Value.ToString();
s += "<br />3:" + e.Item.Cells[3].Value.ToString();
LabelDebugInfo.Text = s;


}
}

}
}


Uncork
Posted: Monday, August 1, 2011 2:39:59 AM
Rank: Member
Groups: Member

Joined: 7/13/2011
Posts: 13
I eventually worked out I needed to add the line

onitemcommand="TestEOGrid_ItemCommand"

It now works OK Angel




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.