This is a migrated thread and some comments may be shown as answers.

OnRowClick Problem

1 Answer 97 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Donald Norris
Top achievements
Rank 1
Donald Norris asked on 19 Aug 2008, 05:37 PM
I am having a problem with the OnRowClick event.  Here is the code.

<

script type="text/javascript">

var

Grid

function

RowSelected(rowIndex)

{

alert(

"Click on row with index: " + rowIndex);

var path = Grid.getCellByColumnUniqueName(Grid.Rows[rowIndex], "DT_FilePath").innerHTML;

var Filename = Grid.getCellByColumnUniqueName(Grid.Rows[rowIndex], "DT_FileName").innerHTML;

alert(

"Path=" + path);

alert(

"Filename=" + Filename);

}

function

GridCreated() {

alert(

"Grid with ClientID: " + this.ClientID + " was created");

Grid =

this;

}

 

</

script>

<

rad:RadGrid ID="DocGrid" runat="server" AutoGenerateColumns="False" DataSourceID="SDS1" GridLines="None" Skin="Green" EnableAJAX="True">

<ClientSettings ApplyStylesOnClient="True">

<Selecting AllowRowSelect="True"></Selecting>

<ClientEvents OnRowClick="RowSelected" OnGridCreated="GridCreated">

</ClientEvents>

</ClientSettings>

<

MasterTableView DataSourceID="SDS1" GridLines="Both">

<

RowIndicatorColumn>

<

HeaderStyle Width="20px"></HeaderStyle>

</

RowIndicatorColumn>

<

ExpandCollapseColumn>

<

HeaderStyle Width="20px"></HeaderStyle>

</

ExpandCollapseColumn>

<Columns>

<rad:GridBoundColumn DataField="DT_FileNum" HeaderText="DT_FileNum" SortExpression="DT_FileNum" UniqueName="DT_FileNum" Display="False">

</rad:GridBoundColumn>

<rad:GridBoundColumn DataField="DT_Desc" HeaderText="Document" SortExpression="DT_Desc" UniqueName="DT_Desc">

<ItemStyle Font-Size="Small" />

</rad:GridBoundColumn>

<rad:GridBoundColumn DataField="DT_DateTime" DataType="System.DateTime" HeaderText="Create Date" SortExpression="DT_DateTime" UniqueName="DT_DateTime"

DataFormatString="{0:MM/dd/yyyy}">

<HeaderStyle Width="70px" />

<ItemStyle Font-Size="Small" />

</rad:GridBoundColumn>

<rad:GridBoundColumn DataField="DT_Clerk" HeaderText="Clerk" SortExpression="DT_Clerk" UniqueName="DT_Clerk">

<HeaderStyle Width="80px" />

<ItemStyle Font-Size="Small" />

</rad:GridBoundColumn>

<rad:GridBoundColumn DataField="DT_FilePath" Display="False" HeaderText="DT_FilePath" SortExpression="DT_FilePath" UniqueName="DT_FilePath">

</rad:GridBoundColumn>

<rad:GridBoundColumn DataField="DT_FileName" Display="False" HeaderText="DT_FileName" SortExpression="DT_FileName" UniqueName="DT_FileName">

</rad:GridBoundColumn>

<rad:GridBoundColumn DataField="DT_DocumentCategory" HeaderText="Category" SortExpression="DT_DocumentCategory" UniqueName="DT_DocumentCategory">

<ItemStyle Font-Size="Small" />

</rad:GridBoundColumn>

</Columns>

</

MasterTableView>

</

rad:RadGrid>

<

asp:SqlDataSource ID="SDS1" runat="server" ConnectionString="<%$ ConnectionStrings:CASConnection %>"

SelectCommand="SELECT [DT_FileNum], [DT_Desc], [DT_DateTime], [DT_Clerk], [DT_FilePath], [DT_FileName], [DT_DocumentCategory] FROM [DocumentTable] WHERE ([DT_FileNum] = @DT_FileNum) ORDER BY [DT_DateTime] DESC, [DT_Desc]">

<SelectParameters>

<asp:SessionParameter DefaultValue="1999001544" Name="DT_FileNum" SessionField="FileNum" Type="String" />

</SelectParameters>

</

asp:SqlDataSource>

In the RowSelected function I get the first alert but not the last two.  What am I doing wrong.

Thanks.

1 Answer, 1 is accepted

Sort by
0
Konstantin Petkov
Telerik team
answered on 20 Aug 2008, 06:37 AM
Hi Donald,

I suppose there is a JavaScript error which prevents the next alerts to appear. The function getCellByColumnUniqueName should start with upper case for the ASP.NET AJAX RadGrid and is part of the MasterTableView class members. I suggest you review the Client-Side API of RadGrid described here.

Best wishes,
Konstantin Petkov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Donald Norris
Top achievements
Rank 1
Answers by
Konstantin Petkov
Telerik team
Share this question
or