Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
68 views
I have a grid that if it is empty I want to open up an insert form on page load and fill in some default values.

Most of the code works except for this.

rgvAgmtUsers.Items[0].FireCommandEvent("InitInsert", string.Empty);

Now this works if there is already a record in the grid, but if the grid is empty then it doesn't work.

after this is supposed to fire I am wanting to use the grd.MasterTableView.GetInsertItem() to grab controls and set default values.

Any ideas?

Thanks,

Dustin
Simone
Top achievements
Rank 1
 answered on 13 Apr 2012
0 answers
88 views

Is it possible?? . I trying but I dont get this. Can you help me please.
It is a feature very important for my project.   :(

thank you.
Renato
Top achievements
Rank 1
 asked on 13 Apr 2012
1 answer
92 views
I am trying to set up a RadGrid with multiple dropdownlist filters but I get an ArgumentOutOfRangeException on the MyCustomFilteringColumn 

Here is code from the MyCustomFilteringColumn  
 :
       Protected Overloads Overrides Sub SetupFilterControls(ByVal cell As TableCell)
            MyBase.SetupFilterControls(cell)
            cell.Controls.RemoveAt(0)
            Dim list As New DropDownList()
            list.ID = "list" + Me.DataField
            list.AutoPostBack = True
            AddHandler list.SelectedIndexChanged, AddressOf list_SelectedIndexChanged
            cell.Controls.AddAt(0, list)
            cell.Controls.RemoveAt(1)
            list.DataTextField = Me.DataField
            list.DataValueField = Me.DataField
            list.DataSource = _listDataSource
            list.DataBind()
        End Sub

My RadGrid columns are setup like the below (here is one of the many that I have): 

         <custom:MyCustomFilteringColumn DataField="AssessmentID" FilterControlAltText="Filter AssessmentID column"
             FilterControlWidth="80px" HeaderStyle-Width="80px" ItemStyle-Width="80px" ItemStyle-ForeColor="Black"
                                                HeaderStyle-Wrap="true" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains"
                                                ShowFilterIcon="false" HeaderText="Assessment ID" SortExpression="AssessmentID"
                                                UniqueName="AssessmentID" />


Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        For Each column As GridBoundColumn In RadGrid1.MasterTableView.Columns
            If TypeOf column Is MyStuff.MyCustomFilteringColumn Then
                CType(column, MyStuff.MyCustomFilteringColumn).ListDataSource = GetFilterTable(column.DataField)
            End If
        Next
end sub

    Private Function GetFilterTable(ByVal Field As String) As DataTable
        Dim strConnection As String = ConfigurationManager.ConnectionStrings("PKLConnectionString").ConnectionString
        Dim objConnection As New SqlConnection(strConnection)
        Dim SQLCmd As New SqlCommand() 'The SQL Command
        objConnection.ConnectionString = strConnection     'Set the Connection String
        objConnection.Open() 'Open the connection
        SQLCmd.Connection = objConnection 'Sets the Connection to use with the SQL Command
        Dim dt As New DataTable
        Dim adapter As SqlDataAdapter
        adapter = New SqlDataAdapter("SELECT distinct [" + Field + "] FROM tblAssessment", objConnection)
        objConnection.Open()
        Try
            adapter.Fill(dt)
        Finally
            objConnection.Close()
        End Try
        Return dt
    End Function

Error:
System.ArgumentOutOfRangeException was unhandled by user code
  Message=Specified argument was out of the range of valid values.
Parameter name: index
  ParamName=index
  Source=System.Web
  StackTrace:
       at System.Web.UI.ControlCollection.get_Item(Int32 index)
       at System.Web.UI.ControlCollection.RemoveAt(Int32 index)
       at MyStuff.MyCustomFilteringColumn.SetupFilterControls(TableCell cell) in D:\PKLQMW AT 04 05 2012\PKL_QMW\App_Code\MyCustomFilteringColumn.vb:line 33
       at Telerik.Web.UI.GridColumn.InitializeCell(TableCell cell, Int32 columnIndex, GridItem inItem)
       at Telerik.Web.UI.GridBoundColumn.InitializeCell(TableCell cell, Int32 columnIndex, GridItem inItem)
       at Telerik.Web.UI.GridItem.Initialize(GridColumn[] columns)
       at Telerik.Web.UI.GridItem.SetupItem(Boolean dataBind, Object dataItem, GridColumn[] columns, ControlCollection rows)
       at Telerik.Web.UI.GridTableView.CreateFilteringItem(Boolean useDataSource, GridColumn[] copiedColumnSet, GridTHead thead)
       at Telerik.Web.UI.GridTableView.CreateControlHierarchy(Boolean useDataSource)
       at Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource)
       at System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data)
       at System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data)
       at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
       at System.Web.UI.WebControls.DataBoundControl.PerformSelect()
       at Telerik.Web.UI.GridTableView.PerformSelect()
       at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
       at Telerik.Web.UI.GridTableView.DataBind()
       at Telerik.Web.UI.RadGrid.DataBind()
       at System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound()
       at System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls()
       at System.Web.UI.Control.EnsureChildControls()
       at System.Web.UI.Control.PreRenderRecursiveInternal()
       at System.Web.UI.Control.PreRenderRecursiveInternal()
       at System.Web.UI.Control.PreRenderRecursiveInternal()
       at System.Web.UI.Control.PreRenderRecursiveInternal()
       at System.Web.UI.Control.PreRenderRecursiveInternal()
       at System.Web.UI.Control.PreRenderRecursiveInternal()
       at System.Web.UI.Control.PreRenderRecursiveInternal()
       at System.Web.UI.Control.PreRenderRecursiveInternal()
       at System.Web.UI.Control.PreRenderRecursiveInternal()
       at System.Web.UI.Control.PreRenderRecursiveInternal()
       at System.Web.UI.Control.PreRenderRecursiveInternal()
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  InnerException: 

Pavlina
Telerik team
 answered on 13 Apr 2012
1 answer
365 views
Hi, 
I apologize for my bad English I'll try to explain as best as possibleThis is my first ticket:you can call a vb sub from javascript written on the same page.

<script type="text/javascript"> LANGUAGE="JavaScript"

      / / Open window 
     OpenFabbricatiRadWindow function () {
         var wnd = $ find ("<= Fabbricati.ClientID%>");
         wnd.setUrl ("Form_Job / radwindow_Fabbricati.aspx");
         wnd.set_modal (true);
         wnd.show ();
     }
     / / Get selected value
     Fabbricatoselect function (senderEventArgs{
         eventArgs.get_argument var args = ();
         if (arg) {
            Varfabbricato.value = arg.Fabbricato;
            Vargestione.value = arg.Gestione;
       
   Call here ************************** **************** sub Leggi'

  }
     }

    
<script>

in the page vb.aspx

Protected Sub Leggi ()
         Dim query = From c In Archivio.Tabelle_Spesa
         In joins and Archivio.Stato On c.Tab_Stato Equals e.Id_Stato
         Select ID_Tabella c.ID_Tabella =Description = c.Tab_DescrizioneAcronym =c.Tab_Siglathousandths = c.Tab_MillesimiState = e.Stato_Descrizione
         Query = RadGrid1.DataSource
         RadGrid1.DataBind ()

     end Sub



Thank

Fabio Cirillo
Top achievements
Rank 1
 answered on 13 Apr 2012
2 answers
72 views
Hi, i have a radgrid with allowpaging.
I need to make a verification in all items in the grid before saving in the database, but the code just verify only ten itens that displayed in the first page. How can i make a solution to resolve this problem ? 

Actually, my code do this: 

      foreach (GridDataItem item in rgdRebanho.Items)
                {
                    CheckBox ckbItem = (CheckBox)((item).FindControl("ckbItem"));
                    if (ckbItem.Checked == true && ckbItem.Enabled == true)
                    {
                            RadDateInput dt_ocorrencia = (RadDateInput)((item).FindControl("dt_ocorrencia"));
                            if (dt_ocorrencia.SelectedDate == null)
                            {
                                erro = true;
                            }
   
                    }
                }



Sorry if have some words wrong, but i don´t speak english very well.


Thanks!
Diego
Top achievements
Rank 1
 answered on 13 Apr 2012
10 answers
238 views
Hi I have a problem I need to change the background color of a timeslot container , when i click over it and is not assigned to a appointment ?

How can i do that ,pleasse help me?
NEX
Top achievements
Rank 1
 answered on 13 Apr 2012
1 answer
84 views
Hi, I have a wizard running as part of a custom add-in for Outlook 2010. In one of the wizard dialogs I have a Telerik GridView control. The wizard dialog window that contains the Grid is re-sizable and I would like to have the Telerik Grid dynamically resize as the user re-sizes the Wizard dialog.

Any suggestions on how to achieve this would be greatly appreciated.

Thanks
Gary 
Pavlina
Telerik team
 answered on 13 Apr 2012
1 answer
85 views
Hi,
I'm got some problem while using the rad slider  control.
1) I using the rad tab strip that have two tabs for each user control inside the multipage container.
2) Each user control page( .ascx) , I using asp.net update panel in order to rendering partially on each page.
eg. I have two user control pages.
general.ascx and slider.ascx(which contain the slider control)
In general page , i have a button named process.
The problem is once i click on the process button in the general.ascx page, and then i go to the slider.ascx page ,the rad slider disappear.
Please see the attachment picture, below.


Thanks
Yamin




Tsvetina
Telerik team
 answered on 13 Apr 2012
9 answers
500 views
I've run into a problem using the asp.net ajax RadComboBox that is dynamically added to the page, which is caused by it losing its value if more than one postback occurs.

I select an item in the combobox and then trigger a postback.  After the first postback the initially selected value is still selected, but after a second postback it is not.  The old style RadComboBox and the built in DropDownList both retain their selected value.

Here's a simple test example that shows the problem.  The aspx simply contains a repeater with a placeholder inside it.

        <asp:ScriptManager ID="scriptManager" runat="server"></asp:ScriptManager> 
        <asp:Repeater ID="repTest" runat="server"
            <ItemTemplate> 
                <div> 
                    <asp:PlaceHolder ID="plcTest" runat="server"></asp:PlaceHolder> 
                </div> 
            </ItemTemplate> 
        </asp:Repeater> 
 
        <asp:Button ID="btnTest" runat="server" Text="PostBack" /> 

In the ItemDataBound event handler the combo boxes are created and added to the placeholder.  If I select Item 2 in each combo box and then click the button twice then at the end the first two combo boxes still have Item 2 selected but the asp.net ajax RadComboBox has reverted to Item 1.

        protected void Page_Load(object sender, EventArgs e) 
        { 
            repTest.DataSource = new int[] { 1, 2, 3 }; 
            repTest.DataBind(); 
        } 
 
        protected override void OnInit(EventArgs e) 
        { 
            base.OnInit(e); 
            repTest.ItemDataBound += new RepeaterItemEventHandler(repTest_ItemDataBound); 
        } 
 
        private void repTest_ItemDataBound(object sender, RepeaterItemEventArgs e) 
        { 
            PlaceHolder plcTest = (PlaceHolder)e.Item.FindControl("plcTest"); 
 
            switch ((int)e.Item.DataItem) 
            { 
                case 1: 
                    DropDownList cbo1 = new DropDownList(); 
                    cbo1.ID = "cbo1"
                    cbo1.DataSource = GetComboData(); 
                    cbo1.DataBind(); 
                    plcTest.Controls.Add(cbo1); 
                    break; 
                case 2: 
                    Telerik.WebControls.RadComboBox cbo2 = new Telerik.WebControls.RadComboBox(); 
                    cbo2.ID = "cbo2"
                    cbo2.DataSource = GetComboData(); 
                    cbo2.DataBind(); 
                    plcTest.Controls.Add(cbo2); 
                    break; 
                case 3: 
                    Telerik.Web.UI.RadComboBox cbo3 = new Telerik.Web.UI.RadComboBox(); 
                    cbo3.ID = "cbo3"
                    cbo3.DataSource = GetComboData(); 
                    cbo3.DataBind(); 
                    plcTest.Controls.Add(cbo3); 
                    break; 
            } 
        } 
 
        private string[] GetComboData() 
        { 
            return "Item 1;Item 2;Item 3".Split(';'); 
        } 
Cat Cheshire
Top achievements
Rank 1
 answered on 13 Apr 2012
1 answer
243 views
Hi,

I have a RadGrid with Items Drag-and-drop functionality. It works great unless I have more than 6 rows which allows a vertical scroll bar in the grid. When I have a vertical scroll bar and try to drag the last item/row to the first or second row, it doesn't work. I have attached snap shots and code.

Looks like the issue is with IE8 Browser.

Please help.

Thanks
<telerik:RadGrid AllowPaging="False" AllowSorting="False" AutoGenerateColumns="False" cssClass="Grid" ID="grdWorkDistrRules"
             ItemPlaceholderID="RulesContainer" OnDetailTableDataBind="grdWorkDistrRules_DetailTableDataBind" OnRowDrop="grdWorkDistrRules_RowDrop"
             OnItemDataBound="grdWorkDistrRules_OnItemDataBound" OnNeedDataSource="grdWorkDistrRules_OnNeedDataSource"
             OnItemCommand="grdWorkDistrRules_ItemCommand"  runat="server" ShowGroupPanel="True" Skin="Windows7" Width="600">
               <MasterTableView DataKeyNames="Id" GroupLoadMode="Server" CommandItemDisplay="Top">
                    <CommandItemTemplate>
                       <telerik:RadToolBar ID="tbRules" runat="server" Width="100%" 
                           OnButtonClick="RadToolBar1_ButtonClick" OnPreRender="tbRules_PreRender">
                           <Items>
                               <telerik:RadToolBarButton Text="All" CommandName="ShowAll"  CheckOnClick="true" Value="ShowAll" Group="Rules" ></telerik:RadToolBarButton>
                               <telerik:RadToolBarButton IsSeparator="true"></telerik:RadToolBarButton>
                               <telerik:RadToolBarButton Text="Active" CommandName="ShowActive"  CheckOnClick="true" Value="ShowActive" Group="Rules"> </telerik:RadToolBarButton>
                               <telerik:RadToolBarButton IsSeparator="true"></telerik:RadToolBarButton>
                               <telerik:RadToolBarButton Text="Inactive" CommandName="ShowInactive" CheckOnClick="true" Value="ShowInactive" Group="Rules"></telerik:RadToolBarButton>                          
                               <telerik:RadToolBarButton IsSeparator="true"></telerik:RadToolBarButton>
                           </Items>
                       </telerik:RadToolBar>
                   </CommandItemTemplate>
 
                   <Columns>                                  
                       <telerik:GridDragDropColumn HeaderStyle-Width="30px" Visible="true" />                    
                       <telerik:GridEditCommandColumn UniqueName="EditRule" ButtonType="ImageButton" HeaderStyle-Width="30px" />                     
                       <telerik:GridBoundColumn UniqueName="Sequence" DataField="Sequence" HeaderText="Sequence" HeaderStyle-Width="70" />
                       <telerik:GridBoundColumn UniqueName="Name" DataField="Name" HeaderText="Name" />
                       <telerik:GridTemplateColumn HeaderText="Queue" >
                           <ItemTemplate>
                               <uc:WorkItemQueue id="ctlWorkItemQueue" runat="server" />
                           </ItemTemplate>
                       </telerik:GridTemplateColumn>                             
                      <telerik:GridBoundColumn UniqueName="Status" DataField="IsActive" HeaderText="Status" HeaderStyle-Width="45"/>
                   </Columns>
                
               <NestedViewSettings >
                   <ParentTableRelation>
                       <telerik:GridRelationFields DetailKeyField="Id" MasterKeyField="Id" />
                   </ParentTableRelation>
               </NestedViewSettings>
               <NestedViewTemplate>
               <asp:Panel ID="NestedViewPanel" runat="server" >
                   <div >
                       <fieldset style="padding: 10px;">
                          <table style="float:left;text-align:top;" >
                               <tr>
                                   <td> Facilities:</td>
                                   <td><%# PopulateFacilities(Eval("Id").ToString())%></td>
                               </tr>
                               <tr>
                                   <td colspan="4">Created by <%# Eval("CreatedBy")%>, <%# Eval("CreatedOn") %></td>
                               </tr>
                               <tr>
                                   <td colspan="4">Modified by <%# Eval("ModifiedBy")%>, <%# Eval("ModifiedOn") %></td>          
                               </tr>
                          </table
                       </fieldset>
                   </div>
               </asp:Panel>
               </NestedViewTemplate>
           </MasterTableView>
           <ClientSettings AllowRowsDragDrop="true">                
                <Selecting AllowRowSelect="True" EnableDragToSelectRows="true"/>
               <Scrolling AllowScroll="true" UseStaticHeaders="true" />
           </ClientSettings>
       </telerik:RadGrid>
Kris
Top achievements
Rank 1
 answered on 13 Apr 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?