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

[Solved] full class of args client event

2 Answers 89 Views
Grid
This is a migrated thread and some comments may be shown as answers.
lang dinh thien
Top achievements
Rank 1
lang dinh thien asked on 28 Aug 2009, 10:04 AM
hi all
i have a problem with radgrid , i hope you can help me to solve this problem,
i have event <ClientEvents OnRowClick="hdRowClick" />
when i use javascript . i wrote in page aspx
function hdRowClick(sender,args)
{ ...... }
and event occur , but i want to use RadAjaxManager to solve this event , i wrote a function in code behind (page aspx.cs)
protected void hdRowClick(object sender, Telerik.Web.UI.GridClientEvents args)
{
            txt_hd_mhd.Text = "abc"; // this is my test for event
}
but event did not occur , i think i chose wrong class for args and event did not occur.
could you give me a solution for my problem . additional i want to take the datakey of the row i selected in client and bring it to code behind so that i can retrieve data from database.
thank you all.

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 28 Aug 2009, 12:01 PM
Hi,

One suggestion would be setting the ClientSetting-EnablePostBackOnRowClick to True and in ItemCommand event check for the CommadName whether its is RowClick, hence you can execute your the server side code there.

ASPX:
 
<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1" OnItemCommand="RadGrid1_ItemCommand"
    <MasterTableView DataKeyNames="CustomerID" DataSourceID="SqlDataSource1"
        <Columns> 
         . . . 
        </Columns> 
    </MasterTableView> 
    <ClientSettings EnablePostBackOnRowClick="true"
    </ClientSettings> 
</telerik:RadGrid> 

C#:
 
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
    if (e.CommandName == "RowClick"
    { 
        string str = (e.Item as GridDataItem).GetDataKeyValue("CustomerID").ToString(); 
        TextBox1.Text = str; 
    } 

-Shinu.
0
lang dinh thien
Top achievements
Rank 1
answered on 28 Aug 2009, 01:02 PM
thank you shinu, but i want to use RadAjaxManager for it because i use this solution for other client event , example rowdoubleclick, onrowselecting,onrowselected...., and RadAjaxmanager help me increase speed of my page. if i use itemcommand  , my page will reload and take more time than RadAjaxManager.
Tags
Grid
Asked by
lang dinh thien
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
lang dinh thien
Top achievements
Rank 1
Share this question
or