Telerik Forums
UI for ASP.NET AJAX Forum
6 answers
165 views
I have worked with grid with several options but I am facing two issues i.e unable to display the RadAjaxLoadingPanel1 in the center of the form on grid and row selected color is displaying multiple colors when row is selected and hover on the row

My code

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default1.aspx.cs" Inherits="_Default1" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
    <link href="Grid.Office2010Silver.css" rel="stylesheet" type="text/css" />
    <link href="Ajax.Office2010Silver.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
    <div>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Visible="true"
            CssClass="RadAjax_Office2010Silver" MinDisplayTime="2000" Transparency="1">
            <asp:Image ID="img" runat="server" ImageUrl="~/loading.gif" />
        </telerik:RadAjaxLoadingPanel>
        <telerik:RadGrid ID="RadGrid1" ShowFooter="false" CssClass="RadGrid_Office2010Silver"
             AllowMultiRowSelection="false" OnItemCommand="RadGrid1_ItemCommand"
            AllowPaging="true" AllowSorting="true" PageSize="10" runat="server" OnPageIndexChanged="RadGrid1_PageIndexChanged"
          EnableAjaxSkinRendering="false"  AllowCustomPaging="True" OnPageSizeChanged="RadGrid1_PageSizeChanged" OnNeedDataSource="RadGrid1_NeedDataSource">
            <PagerStyle Mode="NextPrevAndNumeric" />
            <ClientSettings EnableRowHoverStyle="true">
                <Scrolling AllowScroll="True" UseStaticHeaders="True" ScrollHeight="200" SaveScrollPosition="true"
                    FrozenColumnsCount="3"></Scrolling>
                <Selecting AllowRowSelect="true" />
            </ClientSettings>
            <MasterTableView DataKeyNames="EmployeeID" AutoGenerateColumns="false">
                <Columns>
                    <telerik:GridBoundColumn DataField="EmployeeID" UniqueName="EmployeeID" HeaderText="EmployeeID"
                        HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="FirstName" HeaderStyle-HorizontalAlign="Center"
                        ItemStyle-HorizontalAlign="Center" UniqueName="FirstName" HeaderText="FirstName">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="LastName" UniqueName="LastName" HeaderText="LastName"
                        HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Address" UniqueName="Address" HeaderText="Address"
                        HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
                    </telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
    </div>
    </form>
</body>
</html>


Pavlina
Telerik team
 answered on 17 May 2012
2 answers
269 views
the only thing I could validate the size of the option MaxFileSize. I have to validate to upload a photo that is 96x96 pixels. How do I can do?.

Thanks for your help
ALBERT
Top achievements
Rank 1
 answered on 17 May 2012
2 answers
75 views
Hi,
i am using rad window as a control container, in a sharepoint application, but i have a problem with the title of the window. While the window is loading, the title seems to be ok, but after loading completes, the title changes to the title of the page(.ascx file) the window contains. I tried to remove the title at all with no luck! In visual studio everything works fine...
Can you please help me avoid this situation?

Thanks a lot,
Angie
asilioni
Top achievements
Rank 1
 answered on 17 May 2012
1 answer
116 views
I'm having trouble with post backs on a grid where the columns are created in the code behind. Essentially the columns that go in this grid come from a table, but an administrator has another page where they select what columns from the table show in the grid. So, I have table that stores column names and I dynamically add the columns with their header text and data field id based on this table that stores the columns that need to show. I then dynamically create the select statement, set that as the select command to a sqldatasource and bind it. When you load the page initially everything works fine. However, when you click some paging or sorting, it adds a bunch of extra columns. You can see the before and after here
http://imgur.com/a/gO28G#nOVo1 


Here is my ascx
<telerik:radgrid ID="gradeGrid" runat="server" AllowPaging="True" GridLines="None"
            CellPadding="5" AutoGenerateColumns="false" Width="850px" Skin="Metro" >
        </telerik:radgrid>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:connection %>">
        </asp:SqlDataSource>



here is my code behind
Dim conn = System.Configuration.ConfigurationManager.ConnectionStrings("connection").ToString
 
   'this sub adds a column to the rad grid
   Protected Friend Sub addColumn(ByVal dataField As String, ByVal header As String)
 
       Dim col As New GridBoundColumn
       col.DataField = dataField
       col.HeaderText = header
       gradeGrid.MasterTableView.Columns.Add(col)
 
   End Sub 'addColumn
 
   Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
 
       If (Not Page.IsPostBack) Then
 
           bindGrid()
           gradeGrid.DataBind()
 
       End If 'if its not a  post back
 
   End Sub
 
   'this sub gets the data for the rad grid
   Protected Sub bindGrid()
 
       Dim reader As SqlDataReader
       'add the columns we know about
       addColumn("lgrade", "Letter Grade")
       addColumn("ngrade", "Percent Grade")
       addColumn("Course Code", "sectno")
       addColumn("Completed", "enddate")
 
       Dim itemSql = "SELECT lgrade, ngrade, sectno, enddate, "
       'now find all the other ones we need
       Dim sql = "SELECT columnName, label FROM hstuclsDefinedColumns ORDER BY position"
       Using myconn As New SqlConnection(conn)
 
           myconn.Open()
 
           reader = New SqlCommand(sql, myconn).ExecuteReader()
           If (reader.HasRows) Then
 
               While reader.Read()
                   addColumn(reader("columnName"), reader("label"))
                   itemSql &= "[" & reader("columnName") & "]" & ", "
               End While 'reader.read
               reader.Close()
           End If 'if reader.hasrows
 
           itemSql &= " 'blah' FROM hstucls WHERE stuid = " & MyFunctions.getStudentId
 
           myconn.Close()
       End Using 'using myconn
 
       SqlDataSource1.SelectCommand = itemSql
 
       gradeGrid.DataSource = SqlDataSource1
 
   End Sub 'bindGrid
 
   Protected Sub gradeGrid_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles gradeGrid.NeedDataSource
       bindGrid()
   End Sub

I'm sure it's something stupid, I just don't see what it is. Thanks!

Web Services
Top achievements
Rank 2
 answered on 17 May 2012
1 answer
111 views
HI,

Does the new DLL for Telerik support the older version of IE like IE7 and below.

Thanks,
Raghav.
Eyup
Telerik team
 answered on 17 May 2012
9 answers
175 views
Hello,

At the moment i have my scheduler working, all from the server side. Recurrence is working fine as well, but i also want to "edit this occurence only" option working.

To do this, i wanted to use the "OnRecurrenceExceptionCreated" to get it working.

However, it seems that i cannot retrieve the updated RecurrenceRule with the Exception in it.

I tried to make it work in the RadScheduler_AppointmentUpdate(the recurrencerule with exception) however, i cant determine in this void if there is an Recurrence exception created.

Beneath the three classes i use in combination with customized advanced templates accorinding to youre example in the following link:
advancedformtemplate

I supply them all, so someone else who wants to do it all server side, can find it a bit easier then i could :)

My Code at the moment

Scheduler.
<telerik:RadScheduler runat="server" ID="RadScheduler1" Width="100%" Height="100%" Enabled="false"
    DayStartTime="08:00:00" DayEndTime="22:00:00" WorkDayStartTime="08:00:00" WorkDayEndTime="22:00:00"
    FirstDayOfWeek="Monday" LastDayOfWeek="Friday" HoursPanelTimeFormat="HH:mm" ShowViewTabs="true"
    StartInsertingInAdvancedForm="true" StartEditingInAdvancedForm="true" ShowAllDayRow="false"
    Culture="nl-NL" OnDataBinding="RadScheduler1_DataBinding" OnAppointmentDataBound="RadScheduler1_AppointmentDataBound"
    OnClientFormCreated="schedulerFormCreated" CustomAttributeNames="intSelectedProspectID,intSelectedLocID,RecurrenceRule,id_prospect,strLine1, strLine2, strLine3, strCSS, strBezichtingPand, strTelefoon1, strTelefoon2"
    EnableDescriptionField="true" AppointmentStyleMode="Default" OnAppointmentUpdate="RadScheduler1_AppointmentUpdate" OnRecurrenceExceptionCreated="RadScheduler1_OnRecurrenceExceptionCreated"
    OnAppointmentInsert="RadScheduler1_AppointmentInsert" OnAppointmentCreated="RadScheduler1_AppointmentCreated" OnFormCreated="RadScheduler1_FormCreated">
    <AdvancedForm Modal="false" />
    <Reminders Enabled="false" />
    <AdvancedEditTemplate>
        <scheduler:AdvancedForm runat="server" ID="AdvancedEditForm1" Mode="Edit" Subject='<%# Bind("Subject") %>'
            Description='<%# Bind("Description") %>' Start='<%# Bind("Start") %>' End='<%# Bind("End") %>'
            RecurrenceRuleText='<%# Bind("RecurrenceRule") %>' UserID='<%# Bind("intPersoneelID") %>'
            RoomID='<%# Bind("intKamerID") %>' AfspraakType='<%# Bind("intAfspraakTypeID") %>'
            ProspectID='<%# Bind("id_prospect") %>' Locatie='<%# Bind("intLocatieID") %>' />
    </AdvancedEditTemplate>
    <AdvancedInsertTemplate>
        <scheduler:AdvancedForm runat="server" ID="AdvancedInsertForm1" Mode="Insert" Subject='<%# Bind("Subject") %>'
            Start='<%# Bind("Start") %>' End='<%# Bind("End") %>' Description='<%# Bind("Description") %>'
            RecurrenceRuleText='<%# Bind("RecurrenceRule") %>' UserID='<%# Bind("intPersoneelID") %>'
            RoomID='<%# Bind("intKamerID") %>' AfspraakType='<%# Bind("intAfspraakTypeID") %>'
            ProspectID='<%# Bind("id_prospect") %>' Locatie='<%# Bind("intLocatieID") %>' />
    </AdvancedInsertTemplate>
    <AppointmentTemplate>
        <div class="rsAptSubject">
            <%# Eval("strLine1") %></div>
        <div>
            <%# Eval("strLine2") %></div>
        <div>
            <%# Eval("strLine3") %></div>
    </AppointmentTemplate>
    <TimelineView UserSelectable="false" />
    <TimeSlotContextMenuSettings EnableDefault="true" />
    <AppointmentContextMenuSettings EnableDefault="true" />
</telerik:RadScheduler>

Insert
protected void RadScheduler1_AppointmentInsert(object sender, Telerik.Web.UI.SchedulerCancelEventArgs e)
{
    try
    {
        ArrayList paramList = new ArrayList();
        paramList.Add(new SqlParameter("@afspraakdatum", Convert.ToDateTime(e.Appointment.Start.ToShortDateString() + " " + e.Appointment.Start.ToShortTimeString())));
        paramList.Add(new SqlParameter("@afspraakdatumEind", Convert.ToDateTime(e.Appointment.End.ToShortDateString() + " " + e.Appointment.End.ToShortTimeString())));
        paramList.Add(new SqlParameter("@intAfspraakTypeID", Supervisor.convInt32DBNULL(e.Appointment.Attributes["intAfspraakTypeID"])));
        paramList.Add(new SqlParameter("@strAfspraakOnderwerp", Supervisor.convStringDBNULL(e.Appointment.Subject)));
        paramList.Add(new SqlParameter("@afspraakopmerkingen", Supervisor.convStringDBNULL(e.Appointment.Description)));
        paramList.Add(new SqlParameter("@adviseur_id", Supervisor.convInt32DBNULL(e.Appointment.Attributes["intPersoneelID"])));
        paramList.Add(new SqlParameter("@fiat", fiat));
        paramList.Add(new SqlParameter("@intKamerID", Supervisor.convInt32DBNULL(e.Appointment.Attributes["intKamerID"])));
        paramList.Add(new SqlParameter("@intLocatie", Supervisor.convInt32DBNULL(e.Appointment.Attributes["intLocatieID"])));
        paramList.Add(new SqlParameter("@id_prospect", Supervisor.convInt32DBNULL(e.Appointment.Attributes["id_prospect"])));
        paramList.Add(new SqlParameter("@RecurrenceRule", Supervisor.convStringDBNULL(e.Appointment.RecurrenceRule)));
        paramList.Add(new SqlParameter("@RecurrenceParentKeyField", Supervisor.convStringDBNULL(e.Appointment.RecurrenceParentID)));
        string strSQL = "exec sp_insAfspraakFromPlan4 @afspraakdatum, @afspraakdatumEind, @intAfspraakTypeID, @strAfspraakOnderwerp, @afspraakopmerkingen, @id_prospect, @adviseur_id, @fiat, @intKamerID, @intLocatie,@RecurrenceRule,@RecurrenceParentKeyField";
        string foutmelding = MSSQL_Comm.ExecuteNonQuery(strSQL, paramList, "ConnWB");
        if (foutmelding.Length > 0)
        {
            e.Cancel = true;
            Label Label1 = new Label();
            Label1.Text = foutmelding;
            //NOT WORKING YET!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            ScriptManager.RegisterClientScriptBlock(this, GetType(), "LabelUpdated",
                "$telerik.$('.lblError').show().animate({ opacity: 0.9 }, 2000).fadeOut('slow');", true);
        }
    }
    catch (Exception ex)
    {
        e.Cancel = true;
        Label Label1 = new Label();
        Label1.Text = ex.Message;
        //NOT WORKING YET!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        ScriptManager.RegisterClientScriptBlock(this, GetType(), "LabelUpdated",
            "$telerik.$('.lblError').show().animate({ opacity: 0.9 }, 2000).fadeOut('slow');", true);
    }
}

Update
protected void RadScheduler1_AppointmentUpdate(object sender, Telerik.Web.UI.AppointmentUpdateEventArgs e)
{
    try
    {
        ArrayList paramList = new ArrayList();
        paramList.Add(new SqlParameter("@afspraakdatum", Convert.ToDateTime(e.ModifiedAppointment.Start.ToShortDateString() + " " + e.ModifiedAppointment.Start.ToShortTimeString())));
        paramList.Add(new SqlParameter("@afspraakdatumEind", Convert.ToDateTime(e.ModifiedAppointment.End.ToShortDateString() + " " + e.ModifiedAppointment.End.ToShortTimeString())));
        paramList.Add(new SqlParameter("@intAfspraakTypeID", Supervisor.convInt32DBNULL(e.ModifiedAppointment.Attributes["intAfspraakTypeID"])));
        paramList.Add(new SqlParameter("@strAfspraakOnderwerp", Supervisor.convStringDBNULL(e.ModifiedAppointment.Subject)));
        paramList.Add(new SqlParameter("@afspraakopmerkingen", Supervisor.convStringDBNULL(e.ModifiedAppointment.Description)));
        paramList.Add(new SqlParameter("@adviseur_id", Supervisor.convInt32DBNULL(e.ModifiedAppointment.Attributes["intPersoneelID"])));
        paramList.Add(new SqlParameter("@fiat", 1));
        paramList.Add(new SqlParameter("@intKamerID", Supervisor.convInt32DBNULL(e.ModifiedAppointment.Attributes["intKamerID"])));
        paramList.Add(new SqlParameter("@intLocatie", Supervisor.convInt32DBNULL(e.ModifiedAppointment.Attributes["intLocatieID"])));
        paramList.Add(new SqlParameter("@id_prospect", Supervisor.convInt32DBNULL(e.ModifiedAppointment.Attributes["id_prospect"])));
        paramList.Add(new SqlParameter("@id", e.ModifiedAppointment.ID));
        paramList.Add(new SqlParameter("@RecurrenceRule", Supervisor.convStringDBNULL(e.ModifiedAppointment.RecurrenceRule)));
        paramList.Add(new SqlParameter("@RecurrenceParentKeyField", Supervisor.convStringDBNULL(e.ModifiedAppointment.RecurrenceParentID)));
        string strSQL = "exec sp_updAfspraakFromPlan3 @afspraakdatum, @afspraakdatumEind, @intAfspraakTypeID, @strAfspraakOnderwerp, @afspraakopmerkingen, @id_prospect, @adviseur_id, @fiat, @intKamerID, @id, @RecurrenceRule, @RecurrenceParentKeyField";
        string foutmelding = MSSQL_Comm.ExecuteNonQuery(strSQL, paramList, "ConnWB");
        if (foutmelding.Length > 0)
        {
            e.Cancel = true;
            Label Label1 = new Label();
            Label1.Text = foutmelding;
            ScriptManager.RegisterClientScriptBlock(this, GetType(), "LabelUpdated",
                "$telerik.$('.lblError').show().animate({ opacity: 0.9 }, 2000).fadeOut('slow');", true);
        }
    }
    catch (Exception ex)
    {
        e.Cancel = true;
        Label Label1 = new Label();
        Label1.Text = ex.Message;
        ScriptManager.RegisterClientScriptBlock(this, GetType(), "LabelUpdated",
            "$telerik.$('.lblError').show().animate({ opacity: 0.9 }, 2000).fadeOut('slow');", true);
    }
}

OnRecurrenceException
protected void RadScheduler1_OnRecurrenceExceptionCreated(object sender, Telerik.Web.UI.RecurrenceExceptionCreatedEventArgs e)
{
    int intMasterOccurrenceID = Convert.ToInt32(e.OccurrenceAppointment.ID);
    string RecurrenceRule = e.Appointment.RecurrenceRule;
    string newRecurrenceRule = "?????????????????????????????????????????????????????";
      
    e.Cancel = true;
}

How to make this work asap?
Mike
Top achievements
Rank 1
 answered on 17 May 2012
1 answer
274 views
Dear Sir/Madam,

Please response to my email: Kassaiefarshad@yahoo.com

I have got a RadListView and I have created a Generic List, then I have bound my ListView to Generic List.
You can see part of RadListView as follow:
<telerik:RadListView ID="RadListViewKnowledgeOwners" runat="server"
                        ItemPlaceholderID="ListViewContainer" dir="rtl" Width="600px">
                    <LayoutTemplate>
                                    <asp:PlaceHolder runat="server" id="ListViewContainer" />
                    </LayoutTemplate>
                    <ItemTemplate>
   ...............
 
<table  width="170">
  <tr style="height: 30px;">
       <td>
                <% if (DataBinder.Eval(Container.DataItem , "ScientificResume") != string.Empty)%>
                 <% {%>
                       <a
                              href='http://kms/Resume/<;;%# Eval("ScientificResume")%>'
                              target="_blank">Resume</a>
                   <% }
                        else
                          { %>
                           Resume
                    <% } %>
    </td>
 </tr>
                       </tr>
As you can see in my code :
                      <% if (DataBinder.Eval(Container.DataItem, "ScientificResume") != string.Empty)%>
 
System getting error to me and it doesn't recognize "Container.DataItem". What is "Container.DataItem" in above line of code?

If this approach is not true please guide me how can I do it inside RadListView?

Any help appreciated.
Farshad Kassaie.
Kassaiefarshad@yahoo.com
Richard
Top achievements
Rank 1
 answered on 17 May 2012
0 answers
66 views
I've placed a feature request here that asks Telerik to consider improving Input control to allow it to work as a Tagging input box, common in the Facebook platform. You can see a demo of what I'm asking for here

This control would have the following features:

- Good design
- Allows telerik Themes
- Controls tag duplicates (case sensitive also)
- Allow to add new tags directly
- Allows autocomplete
- Able to bind with data like the other controls
- Has client side methods and events
- Allows tags to have a name and value
- Ability to re-arrange tags by drag and drop
- Ability to provide initial tags on creation

If you like this idea, as I do, please vote for it in the PITS.
Hugo Augusto
Top achievements
Rank 2
Iron
Iron
Veteran
 asked on 17 May 2012
1 answer
116 views
      <telerik:RadGrid ID="RadGrid1" runat="server"
            Width="950px" oninsertcommand="RadGrid1_InsertCommand" 
            onitemcommand="RadGrid1_ItemCommand" onitemcreated="RadGrid1_ItemCreated" 
            oniteminserted="RadGrid1_ItemInserted" 
            onneeddatasource="RadGrid1_NeedDataSource" CellSpacing="0" 
            GridLines="None">
       <MasterTableView  EditMode="InPlace"   >
<CommandItemSettings ExportToPdfText="Export to PDF" ></CommandItemSettings>


<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>


<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
       <Columns><telerik:GridTemplateColumn UniqueName="ADDCombo"><%--<ItemTemplate></ItemTemplate>--%></telerik:GridTemplateColumn></Columns>


<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
       </MasterTableView>


<FilterMenu EnableImageSprites="False"></FilterMenu>


<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
        </telerik:RadGrid>


and on code behind i am creating a dynamic row like that

    public void bindcontroltogrid(RadGrid gridtobind, RadTextBox rdtextgrid, RadComboBox rdcmbgrid)
        {
         
            int j = 0;
            string[] a = {"a" };
            gridtobind.DataSource = null;
            lstvisiblelement = (List<TransactionSetupDL.TrTypeAttrDL>)HttpContext.Current.Session["lstvisiblelementofgrid"];
            gridtobind.MasterTableView.DataSource = a;
            gridtobind.MasterTableView.TableLayout = GridTableLayout.Auto;
            gridtobind.ClientSettings.Scrolling.AllowScroll = true;
            gridtobind.ClientSettings.Scrolling.ScrollHeight = 100;
            gridtobind.MasterTableView.ShowHeadersWhenNoRecords = true;
            gridtobind.MasterTableView.CommandItemSettings.ShowAddNewRecordButton = true;
            gridtobind.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top;
            gridtobind.MasterTableView.EditMode = GridEditMode.InPlace;
            gridtobind.AllowAutomaticDeletes = true;
            gridtobind.AutoGenerateDeleteColumn = true;
            gridtobind.AutoGenerateEditColumn = true;
            
          
            Control container = new Control();
            for (int i = 0; i < lstvisiblelement.Count; i++)
            {
                GridTemplateColumn tc = new GridTemplateColumn();
                ControlType = (BaseBLDL.Global.controlType)lstvisiblelement[i].ControlType;
                switch (ControlType)
                {
                    case BaseBLDL.Global.controlType.bpTxtControl:








                        tc.ItemTemplate = new AddTemplateToGridView(ControlType, lstvisiblelement[i].DefaultVal, lstvisiblelement[i].AttrDefId, lstvisiblelement[i].Editable, rdcmbgrid, rdtextgrid);
                      






                        tc.ItemTemplate.InstantiateIn(container);
           




                        //  gridtobind.MasterTableView.Columns[j].HeaderStyle.Width = lstvisiblelement[i].ColWidth;
                        gridtobind.MasterTableView.Columns.AddAt(j, tc);
                        gridtobind.MasterTableView.Columns[j].HeaderText = lstvisiblelement[i].Label;


                        break;
                    case BaseBLDL.Global.controlType.bpCmbControl:












                        tc.ItemTemplate = new AddTemplateToGridView(ControlType, lstvisiblelement[i].DefaultVal, lstvisiblelement[i].AttrDefId, lstvisiblelement[i].Editable, rdcmbgrid, rdtextgrid);




                        Control containercmb = new Control();


                        tc.ItemTemplate.InstantiateIn(containercmb);


                        //  gridtobind.MasterTableView.Columns[j].ItemStyle.Width = lstvisiblelement[i].ColWidth;




                        gridtobind.MasterTableView.Columns.AddAt(j, tc);
                        gridtobind.MasterTableView.Columns[j].HeaderText = lstvisiblelement[i].Label;


                    
                        break;


                }
                j++;


            }
            gridtobind.Rebind();
            
        }
        public class AddTemplateToGridView : ITemplate
        {
            ListItemType _type;
            string _colName;
            string _DefaultVal;
            int _AttrDefId;
            bool _Editable;
            BaseBLDL.Global.controlType _controltype;
            RadComboBox _cmboxgrid;
            RadTextBox _rdtextbox;
            //ListItemType type, string colname,
            public AddTemplateToGridView(BaseBLDL.Global.controlType controltype, string DefaultVal, int AttrDefId, bool Editable, RadComboBox cmboxgrid, RadTextBox rdtextbox)
            {
                //_type = type;


                //_colName = colname;
                _controltype = controltype;
                _DefaultVal = DefaultVal;
                _AttrDefId = AttrDefId;
                _Editable = Editable;
                _cmboxgrid = cmboxgrid;
                _rdtextbox = rdtextbox;
            }
            void ITemplate.InstantiateIn(System.Web.UI.Control container)
            {




                switch (_controltype)
                {
                    case BaseBLDL.Global.controlType.bpTxtControl:
                        if (_AttrDefId == 13)
                        {
                            Label lb = new Label();
                            lb.Text = "1";


                            container.Controls.Add(lb);
                        }
                        else
                        {
                            _rdtextbox = new RadTextBox();


                            _rdtextbox.Text = _DefaultVal;
                            _rdtextbox.Enabled = _Editable;


                            container.Controls.Add(_rdtextbox);
                        }
                        break;


                    case BaseBLDL.Global.controlType.bpCmbControl:
                        if (_AttrDefId == 17)
                        {
                            _rdtextbox = new RadTextBox();
                            _rdtextbox.Text = _DefaultVal;
                            container.Controls.Add(_rdtextbox);
                        }
                        else
                        {
                            _cmboxgrid = new RadComboBox();


                            _cmboxgrid.Items.Add(new RadComboBoxItem("Select Item"));


                            container.Controls.Add(_cmboxgrid);
                        }
                        break;
                }


            }

now i want to create same row again on add new record button click that is previously created on the code that i above posted 
with combo box and textbox controls kindly help
Tsvetoslav
Telerik team
 answered on 17 May 2012
5 answers
137 views
Hi,

My assignment is to give edit functionality in a grid. when the user clicks on edit user will see textboxes and checkboxlists from which he can manipulate data.

In the Form template I have a CheckBoxList.

<EditFormSettings EditFormType = "Template">
<FormTemplate>
<asp:CheckBoxList  ID= "List2"  runat="server" selectedvalue = '<%# EVal("ApprovedValues")%>' datasource= "sqldatasource1"
datatextfield="value" datavaluefield= "value" tabindex="2">
</asp:heckBoxList>

my problem here is the approvedvalues that i get from the grid can look like a,b,c. I want to recognize all these values and select them from the list coming from sqldatasource1. Also if the approvedvalue has data that does not exist in the sqldatasource1 list I am getting an error.

"list2 has a selected value which is invalid because it does not exist in the list of items."

can anyone help?
Thanks
rms
Top achievements
Rank 1
 answered on 17 May 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?