Welcome Guest Search | Active Topics | Sign In | Register

Grid and raiseItemCommandEvent Options
Seltris
Posted: Monday, July 28, 2008 3:37:34 AM
Rank: Member
Groups: Member

Joined: 10/4/2007
Posts: 20
Hi,

i've an a strange case where i must reload grid (callback mode) after an update of a callbackpanel.
I've create a RefreshGrid javascript function and i've call it in ClientSideAfterUpdate and the debugger pass in this function but the raiseItemCommandEvent don't raise server command.

You can see it in follow code:


Code: Visual Basic.NET
Partial Class Administration_Test
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Me.Grid1.DataSource = CreateTable()
        Me.Grid1.DataBind()
    End Sub

    Private Function CreateTable() As DataTable
        Dim Table As DataTable = New DataTable

        For ColumnIndex As Integer = 0 To 3
            Dim Column As DataColumn = New DataColumn()
            Column.ColumnName = "C" & ColumnIndex
            Column.DataType = GetType(Integer)

            Table.Columns.Add(Column)
        Next

        Dim Rand As Random = New Random(0)

        For RowIndex As Integer = 0 To 10
            Dim Row As DataRow = Table.NewRow

            For ColumnIndex As Integer = 0 To Table.Columns.Count - 1
                Row("C" & ColumnIndex) = Rand.Next()
            Next
        Next

        Return Table
    End Function

    Protected Sub Grid1_ItemCommand(ByVal sender As Object, ByVal e As EO.Web.GridCommandEventArgs) Handles Grid1.ItemCommand
        Dim Obj As Object = Nothing
    End Sub

End Class


Code: HTML/ASPX
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Test.aspx.vb" Inherits="Administration_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>Pagina senza titolo</title>

    <script type="text/javascript">
    
        RefreshGrid = function () {
        debugger;
            var grid = eo_GetObject("Grid1");
            if (grid) grid.raiseItemCommandEvent(0, "Reload");
        };
        
    </script>

</head>
<body>
    <form id="form1" runat="server">
        <div>
            <eo:Grid ID="Grid1" runat="server" BorderColor="#828790" BorderWidth="1px" ColumnHeaderAscImage="00050204"
                ColumnHeaderDescImage="00050205" ColumnHeaderDividerImage="00050203" ColumnHeaderHeight="24"
                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="224px" ItemHeight="19" ScrollBars="Vertical" Width="600px" RunningMode="Callback">
                <FooterStyle CssText="padding-bottom:4px;padding-left:4px;padding-right:4px;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;" />
                    </eo:GridItemStyleSet>
                </ItemStyles>
                <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>
                <ColumnHeaderHoverStyle CssText="background-image:url('00050202');padding-left:8px;padding-top:4px;" />
                <Columns>
                    <eo:StaticColumn DataField="C1" HeaderText="1" Text="" Width="-1">
                    </eo:StaticColumn>
                    <eo:StaticColumn DataField="C2" HeaderText="2" Text="" Width="-1">
                    </eo:StaticColumn>
                    <eo:StaticColumn DataField="C3" HeaderText="3" Width="-1">
                    </eo:StaticColumn>
                </Columns>
                <ColumnHeaderStyle CssText="background-image:url('00050201');padding-left:8px;padding-top:4px;" />
            </eo:Grid>
            <eo:CallbackPanel ID="CallbackPanel1" runat="server" Height="150px" Width="200px" AutoDisableContents="True" ClientSideAfterUpdate="RefreshGrid" Triggers="{ControlID:Button1;Parameter:}">
                <asp:Button ID="Button1" runat="server" Text="Reload Grid" /></eo:CallbackPanel>
            <input id="Button3" type="button" value="Realod Grid" onclick="RefreshGrid();" /> </div>
    </form>
</body>
</html>


Thanks
Seltris
eo_support
Posted: Monday, July 28, 2008 5:40:21 AM
Rank: Administration
Groups: Administration

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

Instead of call RefreshGrid, try call setTimeout("RefreshGrid()", 1);

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.