Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
115 views
I have had to make changes to my FormTemplate fields to keep it from getting an error.
I believe it is because I have changed the fields from using selectedvalue and checked
set to a BIND to using Eval expressions. After making these changes when in edit mode
any changes put into the template fields don't seem to be populating the GridEditableItem
which I believe is the reason for the saves not going to the database now. If I remove
everything under the EditSettings then the grid goes back to successfully saving the 
changes to the database. Below is both my markup and code behind. I can't hitting roadblock 
after roadblock. Any help would be much appreciated?

Markup code: 
<div class="WebpageManagementBox">
       
        <br /><br />
        <asp:Label ID="lblRolePrompt" Text="Select Role to associate web pages:" CssClass="box_Labels" runat="server"></asp:Label>
        <br />
        <telerik:RadDropDownList ID="ddlRoles" runat="server" CssClass="wepageManagementDropDown" Width="200px" DataTextField="role" DataValueField="ID" AutoPostBack="true" OnItemSelected="ddlRoles_ItemSelected"></telerik:RadDropDownList>
        <br />
        <br />
        <telerik:RadGrid ID="RadGridwebpagemanagement" CssClass="webpageManagementGrid" MasterTableView-DataKeyNames="ID" runat="server"
            AllowFilteringByColumn="True" AllowSorting="True"
            GroupPanelPosition="Top" 
            OnNeedDataSource="RadGridwebpagemanagement_NeedDataSource"
            OnUpdateCommand="RadGridwebpagemanagement_UpdateCommand" OnItemDataBound="RadGridwebpagemanagement_ItemDataBound" OnDeleteCommand="RadGridwebpagemanagement_DeleteCommand" OnInsertCommand="RadGridwebpagemanagement_InsertCommand">
            <ClientSettings>
                <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                <Selecting AllowRowSelect="true" />
            </ClientSettings>
            <GroupingSettings CaseSensitive="false" />
            <MasterTableView AutoGenerateColumns="false" CommandItemDisplay="Top" CommandItemSettings-AddNewRecordText="Add New Webpage" 
                 InsertItemPageIndexAction="ShowItemOnCurrentPage">
 
                <columns>
                     
                    <telerik:GridBoundColumn DataField="webpage_name" HeaderText="Web Page" UniqueName="webpage_name" ItemStyle-Font-Names="Arial" ItemStyle-Font-Bold="true"
                                FilterControlWidth="200px">
                                <HeaderStyle Width="230px" Font-Names="Arial" />
                                <ItemStyle Width="230px" />
                    </telerik:GridBoundColumn>
                    
                    <telerik:GridCheckBoxColumn DataField="add_privledge" HeaderText="Allow Adds" UniqueName="add_privledge"
                                FilterControlWidth="120px">               
                                <HeaderStyle Width="120px" Font-Names="Arial" />
                                <ItemStyle Width="120px" />
                    </telerik:GridCheckBoxColumn>
                     
                    <telerik:GridCheckBoxColumn DataField="edit_privledge" HeaderText="Allow Edits" UniqueName="edit_privledge"
                                FilterControlWidth="120px">               
                                <HeaderStyle Width="120px" Font-Names="Arial" />
                                <ItemStyle Width="120px" />
                   </telerik:GridCheckBoxColumn>
 
                     <telerik:GridCheckBoxColumn DataField="delete_privledge" HeaderText="Allow Deletes" UniqueName="delete_privledge"
                              FilterControlWidth="120px">               
                                <HeaderStyle Width="120px" Font-Names="Arial" />
                                <ItemStyle Width="120px" />
                    </telerik:GridCheckBoxColumn>                  
 
                   <telerik:GridEditCommandColumn ButtonType="LinkButton" EditText="Edit" CancelText="Cancel" ItemStyle-Width="50px" HeaderStyle-Width="50px" FilterControlWidth="50px" />
                   <telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow"
                        ConfirmTitle="Delete" ButtonType="LinkButton" Text="Delete" CommandName="Delete" ItemStyle-Width="50px" HeaderStyle-Width="50px" FilterControlWidth="50px" />
                     
                </columns>
                
                <EditFormSettings EditFormType="Template">
                <FormTemplate>   
                    
                   
                    <div id="divGridEdit" class="divGrid">
                            <b>Add New Role to Webpage Association</b>
                            <br /><br />
                            <table>
 
                                <tr>
                                    <td><asp:Label Text="Web Page:" runat="server"></asp:Label></td>
                                    <td>
                                         <asp:DropDownList ID="ddlWebPages" DataSourceID="sqlDataSourceWebpages" AppendDataBoundItems="True" DataTextField="webpage_name" DataValueField="ID"
                                               SelectedValue='<%# DataBinder.Eval(Container.DataItem,"security_webpage_id") == DBNull.Value ? "" : DataBinder.Eval(Container.DataItem,"security_webpage_id") %>'
                                                runat="server"> 
                                                <asp:ListItem Value=""></asp:ListItem>
                                         </asp:DropDownList>
 
                                    </td>
                                </tr>
                                
                                <tr>
                                    <td><br /></td>
                                    <td></td>
                                </tr>
                                <tr>
                                     <td><asp:Label Text="Allow Add:" runat="server"></asp:Label></td>
                                     <td><asp:CheckBox ID="chkboxAllowAdd" Checked='<%# DataBinder.Eval(Container.DataItem,"add_privledge") == DBNull.Value ? false : DataBinder.Eval(Container.DataItem,"add_privledge") %>' runat="server" /></td>
                                </tr>
                                <tr>
                                     <td><asp:Label Text="Allow Edit:" runat="server"></asp:Label></td>
                                     <td><asp:CheckBox ID="chkboxAllowEdit" Checked='<%# DataBinder.Eval(Container.DataItem,"edit_privledge") == DBNull.Value ? false : DataBinder.Eval(Container.DataItem,"edit_privledge") %>' runat="server" /></td>
                                </tr>
                                <tr>
                                     <td><asp:Label Text="Allow Delete:" runat="server"></asp:Label></td>
                                     <td><asp:CheckBox ID="chkboxDelete" Checked='<%# DataBinder.Eval(Container.DataItem,"delete_privledge") == DBNull.Value ? false : DataBinder.Eval(Container.DataItem,"delete_privledge") %>' runat="server" /></td>
                                </tr>
 
                                <tr>
                                    <td><asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                        CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'  runat="server" /></td>
                                    <td><asp:Button ID="btnCancel" Text="Cancel" runat="server" CommandName="Cancel" CausesValidation="false" /></td>
                                </tr>
                            </table>
                        </div>            
 
                </FormTemplate>
            </EditFormSettings>
 
 
            </MasterTableView>
            <ClientSettings>
                <ClientEvents OnRowDblClick="rowDblClick" />
            </ClientSettings>
                
        </telerik:RadGrid>
 
 
    </div>
 
    <asp:SqlDataSource ID="sqlDataSourceWebpages" runat="server" SelectCommand="SELECT * FROM dbo.security_webpage" ConnectionString="<%$ ConnectionStrings:GATEConnectionString %>"></asp:SqlDataSource>
 
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" />

Code Behind:

using GATE_Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using System.Collections;
 
 
namespace FRC
{
    public partial class WebPageManagemet : System.Web.UI.Page
    {
 
        
        protected void Page_Load(object sender, EventArgs e)
        {
             
            
 
            if (!IsPostBack)
            {
                 
                GATEEntities dbContext = new GATEEntities();
             
                // Load Role Drop-down List
                var rolequery = from r in dbContext.Security_Role
                                select r;
 
                IEnumerable<Security_Role> roles = rolequery.ToList();
                ddlRoles.DataSource = roles;
                ddlRoles.DataBind();              
 
            }
            
        }
 
        protected void RadGridwebpagemanagement_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
           
 
            int? selectedroleid = Convert.ToInt32(ddlRoles.SelectedValue);
 
            // Use LINQ query to populate radGrid
            GATEEntities dbContext = new GATEEntities();
 
            var query = from srw in dbContext.Security_Role_To_Webpage
                        join sw in dbContext.Security_Webpage on srw.security_webpage_id equals sw.ID
                        where srw.security_role_id == selectedroleid
                        select new
                        {
                            srw.ID,
                            srw.security_webpage_id,
                            sw.webpage_name,
                            srw.add_privledge,
                            srw.edit_privledge,
                            srw.delete_privledge,
                            srw.view_privledge
                         
                        };
 
            //IEnumerable<Security_Role_To_Webpage> securitypages = query.ToList();
 
            RadGridwebpagemanagement.DataSource = query.ToList();
                      
 
        }
 
        protected void ddlRoles_ItemSelected(object sender, Telerik.Web.UI.DropDownListEventArgs e)
        {
            RadGridwebpagemanagement.Rebind();
        }
 
        
 
        protected void RadGridwebpagemanagement_ItemDataBound(object sender, GridItemEventArgs e)
        {
             
            if (e.Item.FindControl("ddlWebPages") != null )
            {
                GridEditableItem editedItem = e.Item as GridEditableItem;
                DropDownList _ddl = (DropDownList)e.Item.FindControl("ddlWebPages");
                if (_ddl != null)
                {
                    _ddl.DataSourceID = "";
                    _ddl.Items.Clear();
                    ListItem newitem = new ListItem("","");
                    _ddl.Items.Add(newitem);
                    _ddl.DataSource = this.sqlDataSourceWebpages;
                    _ddl.DataTextField = "webpage_name";
                    _ddl.DataValueField = "ID";
                    _ddl.DataBind();
                     
                }
            }
            
 
        }
 
        protected void RadGridwebpagemanagement_DeleteCommand(object sender, GridCommandEventArgs e)
        {
            GATE_Entity.GATEEntities dbContext = new GATEEntities();
 
            var editableItem = ((GridEditableItem)e.Item);
            var lookupID = (int)editableItem.GetDataKeyValue("ID");
 
            // Retrieve Entity
            var webpagerecord = dbContext.Security_Role_To_Webpage.Where(n => n.ID == lookupID).FirstOrDefault();
 
            if (webpagerecord != null)
            {
                // set for deletion
                dbContext.Security_Role_To_Webpage.Remove(webpagerecord);
                 
                try
                {
 
                    // Save changes to db
                    dbContext.SaveChanges();
 
                }
                catch (System.Exception)
                {
 
                }
 
            }
 
        }
        private void DisplayMessage(string text)
        {
            RadGridwebpagemanagement.Controls.Add(new LiteralControl(string.Format("<span style='color:red'>{0}</span>", text)));
        }
        protected void RadGridwebpagemanagement_UpdateCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
 
            GATEEntities dbContext = new GATEEntities();
 
            var editableItem = ((GridEditableItem)e.Item);
            var lookupID = (int)editableItem.GetDataKeyValue("ID");
 
             
            DropDownList ddlwebpage = (DropDownList)editableItem.FindControl("ddlWebPages");
            var selectedval = Convert.ToInt32(ddlwebpage.SelectedValue);
 
            // Check to make sure user didn't select webpage for this role that is already within the role
 
            var roleid = Convert.ToInt32(ddlRoles.SelectedValue);
            var webpagerecexist = (from srw in dbContext.Security_Role_To_Webpage
                                  where srw.security_role_id == roleid &&
                                  srw.security_webpage_id == selectedval &&
                                  srw.ID != lookupID
                                  select srw).ToList();
 
 
            // If Count > 0 then user chose drop down webpage that is already associated with role
            if (webpagerecexist.Count == 0)
            {
             
                // create sql criteria with which the changes will be applied to
                var webpagerecord = dbContext.Security_Role_To_Webpage.Where(n => n.ID == lookupID).FirstOrDefault();
 
                if (webpagerecord != null)
                {
                    // update entity's state
                    editableItem.UpdateValues(webpagerecord);
 
                    try
                    {
 
                        // Save changes to db
                        dbContext.SaveChanges();
 
                    }
                    catch (System.Exception)
                    {
 
                    }
 
                }
            }          
            else
            {
 
                DisplayMessage("The webpage you selected already exists for this role!");
                // keep in update mode
                e.Canceled = true;
 
 
 
            }
        
 
        }
 
        protected void RadGridwebpagemanagement_InsertCommand(object sender, GridCommandEventArgs e)
        {
 
            GATEEntities dbContext = new GATEEntities();
 
            var editableItem = ((GridEditableItem)e.Item);
 
            Hashtable values = new Hashtable();
 
            editableItem.ExtractValues(values);
 
            var newrec = dbContext.Security_Role_To_Webpage.Create();
 
 
            newrec.security_webpage_id = (int?)values["security_webpage_id"];
            newrec.security_role_id = (int?)values["security_role_id"];
            newrec.add_privledge = (bool?)values["add_privledge"];
            newrec.edit_privledge = (bool?)values["edit_privledge"];
            newrec.delete_privledge = (bool?)values["delete_privledge"];
 
            dbContext.SaveChanges();
             
 
        }
 
 
 
 
    }
}

Viktor Tachev
Telerik team
 answered on 16 Feb 2015
1 answer
180 views
I am trying to get a value from a popup window. 

My process goes like this.

When a user clicks on a value from a RadDropDownList (CUST_NBRDropDown) I have OnClientItemSelected fire a popup

<telerik:RadDropDownList ID="CUST_NBRDropDown" runat="server" DataSourceID="Customer_DDL" DataTextField="account_name" DataValueField="account_number" DropDownHeight="400px" SelectedValue='<%# Bind("CUST_NBR")%>' OnClientItemSelected="OnClientItemSelected">
</telerik:RadDropDownList>


function OnClientItemSelected(sender, eventArgs) {
     var item = eventArgs.get_item();
    //alert("You selected " + item.get_text() + " with value " + item.get_value());
    retVal = window.open("BSDM_PLANT_BACKNUMBERS_popup.aspx?acct_num=" + item.get_value(), "Popup", "width=300,height=100");
    retVal.focus();
 }

On the BSDM_PLANT_BACKNUMBERS_popup.aspx page i have a RadComboBox that i want the user to be able to select one of the values from.(This dropdown is populated from a Oracle DB. with the filter from the original 'CUST_NBRDropDown' dropdown.)

After they select a value i want to return the selected value back to the BSDM_PLANT_BACKNUMBERS (Parent) page to a Textbox in the same row as the original RadDropDownList.
<asp:TextBox ID="CUST_NBR_txt" runat="server" Text='<%# Bind("CUST_NBR") %>' Visible="true"></asp:TextBox>

So far I have not been able todo that.


If possible instead of doing a popup i would like to be able to have the dropdown that is populated in the Popup window to be in the radgrid row. but from my understanding i cannot bind the dropdown in "batch edit mode" after the CUST_NBRDropDown is selected since this is all client side functions...


Any help would be greatly appreciated!

Angel Petrov
Telerik team
 answered on 16 Feb 2015
1 answer
67 views
Hi

I need how to insert,Update,Delete using WCF Service client side only in Telerik grid using 
Viktor Tachev
Telerik team
 answered on 16 Feb 2015
1 answer
105 views
We have requirements for 508 and WCAG within our system.  I have been testing the ability to move between the controls using the keyboard and ran across a problem with the radtoolbar so am looking for a way to get it working.

In the example below i can use the keyboard and tab through the open, save, cancel options on the main tool bar.  When i stop on the "open tab" option i use the down arrow key to open up the radmenu.  i can use the up/down arrow to move up down through the menu without any issues.

the problem comes in when i need to expand the "level 1a" menu.  when focus is on that item, i hit the right arrow to expand the menu out.  however, what happens when i click the right arrow key is that the focus moves to the "save" menu option on the toolbar. so i can't open that lower level menu and continue using the keyboard to get into the level 2a-e menu options.

Is this a bug in the controls?  Is there a way to workaround the issue so i can use the keyboard to access the level 2 menu items?


              <telerik:RadToolBar ID="RadToolBar1" runat="server">
                <Items>
                    <telerik:RadToolBarButton>
                        <ItemTemplate>
                            <telerik:RadMenu runat="server">
                                <Items>
                                    <telerik:RadMenuItem Text="open tab">
                                        <Items>
                                            <telerik:RadMenuItem Text="level 1a">
                                                <Items>
                                                    <telerik:RadMenuItem Text="level 2a"></telerik:RadMenuItem>
                                                    <telerik:RadMenuItem Text="level 2b"></telerik:RadMenuItem>
                                                    <telerik:RadMenuItem Text="level 2c"></telerik:RadMenuItem>
                                                    <telerik:RadMenuItem Text="level 2d"></telerik:RadMenuItem>
                                                    <telerik:RadMenuItem Text="level 2e"></telerik:RadMenuItem>
                                                </Items>
                                            </telerik:RadMenuItem>
                                            <telerik:RadMenuItem Text="level 1b"></telerik:RadMenuItem>
                                            <telerik:RadMenuItem Text="level 1c"></telerik:RadMenuItem>
                                            <telerik:RadMenuItem Text="level 1d"></telerik:RadMenuItem>
                                        </Items>
                                    </telerik:RadMenuItem>
                                </Items>
                            </telerik:RadMenu>
                        </ItemTemplate>
                    </telerik:RadToolBarButton>
                    <telerik:RadToolBarButton Text="save"></telerik:RadToolBarButton>
                    <telerik:RadToolBarButton Text="cancel"></telerik:RadToolBarButton>
                </Items>
            </telerik:RadToolBar>

Hristo Valyavicharski
Telerik team
 answered on 16 Feb 2015
9 answers
471 views
Hi All,

I am using a grid with batch edit mode set.  

I need to be able to add via javascript a new row to my grid with no callbacks in the middle.  Is there a way to do this?

Regards

Jon
Jon
Top achievements
Rank 1
 answered on 16 Feb 2015
6 answers
290 views
I have a standard RadWizard. It is within an RadUpdatePanel. On page load I have a chunk of code.... Product is a global Object

If Not IsPostBack Then
    'do something
*   Session("Product") = Product
Else
    'do something else
*   If Not isNothing(Session("Product")) Then
        Product = Session("Product")
    End If
End

* = Breakpoint

I have placed a breakpoint within 'do something' and one within 'do something else'.

When I run the page the 'do something' code runs as expected. The 'do something else' is not run - as it's not a postback this is correct.

Whenever I click the Next button of the RadWizard the 'do something' code runs - hovering over IsPostback shows that it's value is FALSE... but it should surely be TRUE. If I continue from this breakpoint the 'do something else' code runs - hovering over IsPostback now shows it's value to be TRUE.

Why are both the Not IsPostback and the IsPostback code executed when the Next button is fired?
Plamen
Telerik team
 answered on 16 Feb 2015
3 answers
89 views
hi all,
I am using RadScheduler in monthview. I made the appointment editable, clickable on clientside ( using clientside event, I am familiar with those).... But I am not able to make the appointment Resizable, Moveable.
( it is Resizable and Moveable in TimelineView).

I examine the HTML that being rendered, I notice that the Appoinments HTML does not have the DIV rsAptResize as it does in Timelineview. (refer to the attachment)

What could possibly caused this ? Can someone shed a light. May be someone from Telerik is familiar with the way the control is being rendered...
( I customize the RadScheduler and Appointment template, can this be a reason why? But it work find in TimeLine view? And in MonthView, I apply the same process. In MonthView the Appointments are clickable but note moveable...)

regards.

Hien Lam
Top achievements
Rank 1
 answered on 16 Feb 2015
1 answer
296 views
How do I add a onclick handler to my DocumentManager control? I can alter the href or URL property from a ExtendedFileProvider to add "javascript:clickHandler()". But this isn't good practice.

I have both a LinkManager and a DocumentManager. How do I add an onClick to the <a> tags that get generated by these controls?

Thank you!
Ianko
Telerik team
 answered on 16 Feb 2015
2 answers
101 views
I am getting an error:
'ddlWebPages' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value


This happens only when I click the Add New Record button on the grid. the ddlWebPages has no issues when I am in edit mode.
I believe this has to do the the snippet SelectedValue='<%# Bind("security_webpage_id") %> of the dropdownlist. 
I searched for solutions but none of them worked. There was one suggestion for SelectedValue='<%# Eval("security_webpage_id") == null ? null :  Eval("security_webpage_id") %>'. That didnt work for me. Has anyone dealt with this issue? HELP! I am so close to finishing my grid.



<telerik:RadGrid ID="RadGridwebpagemanagement" CssClass="webpageManagementGrid" MasterTableView-DataKeyNames="ID" runat="server"
            AllowFilteringByColumn="True" AllowSorting="True"
            GroupPanelPosition="Top" 
            OnNeedDataSource="RadGridwebpagemanagement_NeedDataSource"
            OnUpdateCommand="RadGridwebpagemanagement_UpdateCommand" OnItemDataBound="RadGridwebpagemanagement_ItemDataBound" OnDeleteCommand="RadGridwebpagemanagement_DeleteCommand" OnInsertCommand="RadGridwebpagemanagement_InsertCommand">
            <ClientSettings>
                <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                <Selecting AllowRowSelect="true" />
            </ClientSettings>
            <GroupingSettings CaseSensitive="false" />
            <MasterTableView AutoGenerateColumns="false" CommandItemDisplay="Top" CommandItemSettings-AddNewRecordText="Add New Webpage" 
                 InsertItemPageIndexAction="ShowItemOnCurrentPage">
 
                <columns>
                     
                    <telerik:GridBoundColumn DataField="webpage_name" HeaderText="Web Page" UniqueName="webpage_name" ItemStyle-Font-Names="Arial" ItemStyle-Font-Bold="true"
                                FilterControlWidth="200px">
                                <HeaderStyle Width="230px" Font-Names="Arial" />
                                <ItemStyle Width="230px" />
                    </telerik:GridBoundColumn>
                    
                    <telerik:GridCheckBoxColumn DataField="add_privledge" HeaderText="Allow Adds" UniqueName="add_privledge"
                                FilterControlWidth="120px">               
                                <HeaderStyle Width="120px" Font-Names="Arial" />
                                <ItemStyle Width="120px" />
                    </telerik:GridCheckBoxColumn>
                     
                    <telerik:GridCheckBoxColumn DataField="edit_privledge" HeaderText="Allow Edits" UniqueName="edit_privledge"
                                FilterControlWidth="120px">               
                                <HeaderStyle Width="120px" Font-Names="Arial" />
                                <ItemStyle Width="120px" />
                   </telerik:GridCheckBoxColumn>
 
                     <telerik:GridCheckBoxColumn DataField="delete_privledge" HeaderText="Allow Deletes" UniqueName="delete_privledge"
                              FilterControlWidth="120px">               
                                <HeaderStyle Width="120px" Font-Names="Arial" />
                                <ItemStyle Width="120px" />
                    </telerik:GridCheckBoxColumn>                  
 
                   <telerik:GridEditCommandColumn ButtonType="LinkButton" EditText="Edit" CancelText="Cancel" ItemStyle-Width="50px" HeaderStyle-Width="50px" FilterControlWidth="50px" />
                   <telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow"
                        ConfirmTitle="Delete" ButtonType="LinkButton" Text="Delete" CommandName="Delete" ItemStyle-Width="50px" HeaderStyle-Width="50px" FilterControlWidth="50px" />
                     
                </columns>
                
                <EditFormSettings EditFormType="Template">
                <FormTemplate>   
                    
                   
                    <div id="divGridEdit" class="divGrid">
                            <b>Add New Role to Webpage Association</b>
                            <br /><br />
                            <table>
 
                                <tr>
                                    <td><asp:Label Text="Web Page:" runat="server"></asp:Label></td>
                                    <td>
                                         <asp:DropDownList ID="ddlWebPages"  DataSourceID="sqlDataSourceWebpages" AppendDataBoundItems="True"
                                                DataTextField="webpage_name" DataValueField="ID" SelectedValue='<%# Bind("security_webpage_id") %>'
                                                runat="server"> 
                                          
                                         </asp:DropDownList>
 
                                    </td>
                                </tr>
                                <tr>
                                     <td><asp:Label Text="Allow Add:" runat="server"></asp:Label></td>
                                     <td><asp:CheckBox ID="chkboxAllowAdd" Checked='<%# Bind("add_privledge") %>' runat="server" /></td>
                                </tr>
                                <tr>
                                     <td><asp:Label Text="Allow Edit:" runat="server"></asp:Label></td>
                                     <td><asp:CheckBox ID="chkboxAllowEdit" Checked='<%# Bind("edit_privledge") %>' runat="server" /></td>
                                </tr>
                                <tr>
                                     <td><asp:Label Text="Allow Delete:" runat="server"></asp:Label></td>
                                     <td><asp:CheckBox ID="chkboxDelete" Checked='<%# Bind("delete_privledge") %>' runat="server" /></td>
                                </tr>
                                <tr>
                                    <td><br /></td>
                                    <td></td>
                                </tr>
                                <tr>
                                    <td><asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                        CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'  runat="server" /></td>
                                    <td><asp:Button ID="btnCancel" Text="Cancel" runat="server" CommandName="Cancel" CausesValidation="false" /></td>
                                </tr>
                            </table>
                        </div>            
 
                </FormTemplate>
            </EditFormSettings>
 
 
            </MasterTableView>
            <ClientSettings>
                <ClientEvents OnRowDblClick="rowDblClick" />
            </ClientSettings>
                
        </telerik:RadGrid>
 
 
    </div>
 
    <asp:SqlDataSource ID="sqlDataSourceWebpages" runat="server" SelectCommand="SELECT * FROM dbo.security_webpage" ConnectionString="<%$ ConnectionStrings:GATEConnectionString %>"></asp:SqlDataSource>
 
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" />
David
Top achievements
Rank 1
 answered on 13 Feb 2015
17 answers
1.3K+ views
Hello,
I'm have a RadGrid with 2 template columns. During ItemDataBound I'm dynamically creating a textbox and adding it to the Grid like this:

GridDataItem gdi = (GridDataItem)e.item

TextBox tb = new TextBox();
tb.ID = tbID;
tb.EnabeViewState = true;
gdi["column name"].controls.add(tb);

"Colum name" is a template column in the grid

I have another template column with a button in it that is created at design time. When I click that button I want to be able to find the dynamically created text box in the same row of the grid and read it's value.
How do I accomplish this?

Thanks in advance
Viktor Tachev
Telerik team
 answered on 13 Feb 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?