<telerik:GridButtonColumn ButtonType=ImageButton ImageUrl="images/Img_Del.gif"></telerik:GridButtonColumn> I want to tie the button click to a javascript function. Is this possible?
I want to do an AJAX call from this function to perform the delete operation and refresh the grid.
Appreciate a reply.
thanks
<
telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource"
Height="100px" Width="600px" >
<MasterTableView AutoGenerateColumns="false" >
<Columns>
<telerik:GridBoundColumn DataField="ContactName" DataType="System.String"
HeaderText="Contact Name" ReadOnly="True"
>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Title" DataType="System.String"
HeaderText="Title" ReadOnly="True"
>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Email" DataType="System.String"
HeaderText="Email" ReadOnly="True"
>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Phone" DataType="System.String"
HeaderText="Phone" ReadOnly="True"
>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Fax" DataType="System.String"
HeaderText="Fax" ReadOnly="True"
>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ContactType" DataType="System.String"
HeaderText="Contact Type" ReadOnly="True"
>
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings>
<Scrolling AllowScroll="True" UseStaticHeaders="True" />
</ClientSettings>
</telerik:RadGrid>
</td>
</tr>
</table>
protected void btnRecord_Click(object sender, EventArgs e)
{
RadGrid1.DataSource =
null;
RadGrid1.Rebind();
}
protected
void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
Contact curContact = new Contact();
curContact.ContactName = TextBox1.Text;
curContact.Title = TextBox2.Text;
curContact.Email = TextBox3.Text;
curContact.Phone = TextBox4.Text;
curContact.Fax = TextBox5.Text;
if (Session["ContactType"] != null)
{
curContact.ContactType = Session[
"ContactType"].ToString();
}
DataTable dt = new DataTable();
dt.Columns.Add(
"ContactName");
dt.Columns.Add(
"Title");
dt.Columns.Add(
"Email");
dt.Columns.Add(
"Phone");
dt.Columns.Add(
"Fax");
dt.Columns.Add(
"ContactType");
dt.Rows.Add(curContact.ContactName, curContact.Title, curContact.Email, curContact.Phone, curContact.Fax,
curContact.ContactType);
RadGrid1.DataSource = dt;
}