3 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 08 Nov 2012, 04:18 AM
Hi Matt,
I guess you want to access a GridCheckBoxColumn in Edit form popup. Please take a look into the following code snippet I tried to access the CheckBoxColumn in an External Button Click.
ASPX:
C#:
Javascript:
Thanks,
Shinu.
I guess you want to access a GridCheckBoxColumn in Edit form popup. Please take a look into the following code snippet I tried to access the CheckBoxColumn in an External Button Click.
ASPX:
<asp:Button ID="button1" runat="server" Text="Test" OnClientClick="ClientClick() ;return false"/>C#:
protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e){ if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode)) { { GridEditableItem editForm = (GridEditableItem)e.Item; CheckBox chk = (CheckBox)(editForm["uniqueName"].Controls[0]); RadGrid1.Controls.Add(new LiteralControl("<script type='text/javascript'>window['check'] = '" + chk.ClientID + "';</script>")); } }}Javascript:
<script type="text/javascript"> function ClientClick() { var EntityKeyName = document.getElementById(window['check']); }</script>Thanks,
Shinu.
0
Matt
Top achievements
Rank 1
answered on 08 Nov 2012, 03:14 PM
This isn't exactly what I was looking for. What I wanted to accomplish was include a checkbox in an edit popup form and on the click event, either disable or enable textboxes on the same edit form. I decided to create a UserControl in my edit form and do it all server side instead. Seems to be much easier with an acceptable sacrifice in performance.
Thanks anyway.
Thanks anyway.
0
Shinu
Top achievements
Rank 2
answered on 09 Nov 2012, 04:57 AM
Hi,
You can access the controls in usercontrol from server side as shown below.
C#:
Thanks,
Shinu.
You can access the controls in usercontrol from server side as shown below.
C#:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e){ if (e.Item is GridEditFormItem && e.Item.IsInEditMode) { GridEditFormItem editItem = (GridEditFormItem)e.Item; UserControl userControl = (UserControl)editItem.FindControl(GridEditFormItem.EditFormUserControlID); CheckBox chk = (CheckBox)userControl.FindControl("CheckBox1"); chk.AutoPostBack = true; chk.CheckedChanged += new EventHandler(chk_CheckedChanged); }}void chk_CheckedChanged(object sender, EventArgs e){ CheckBox chk = (CheckBox)sender; UserControl ctl = (UserControl)chk.NamingContainer; TextBox txt = (TextBox)ctl.FindControl("TextBox1"); txt.Text = "your text";}Thanks,
Shinu.