Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
74 views

Is it possible to toggle column visibilty/editing on a grid with a declarative datasource?

We have a requirement to show/hide certain columns in tables we'd like to display using a RadGrid.

We also have a requirement to enable/disable the editing of certain columns in tables we'd like to display using a RadGrid.

There is a master table in the database that stores the tablename, columnname, visible (0 or 1), editable (0 or 1) data.

Is it possible to use the values in that master table to control which columns are visible/hidden and to enable/disable the editing of certain columns in a RadGrid that has a declarative datasource?

 

Konstantin Dikov
Telerik team
 answered on 24 Jun 2016
1 answer
417 views

when i bind grid without  ItemDataBound it bind fine. But when i use it , then it show the Exception of type 'System.OutOfMemoryException' was thrown. error.

Here is my code

   protected void griddetails_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                griddetails.MasterTableView.RenderColumns[4].Display = false;
                griddetails.MasterTableView.RenderColumns[5].Display = false;
                griddetails.MasterTableView.RenderColumns[6].Display = false;
                griddetails.MasterTableView.RenderColumns[7].Display = false;

                griddetails.MasterTableView.RenderColumns[10].Display = false;
                griddetails.MasterTableView.RenderColumns[11].Display = false;
                griddetails.MasterTableView.RenderColumns[26].Display = false;
                griddetails.MasterTableView.RenderColumns[30].Display = false;
                griddetails.MasterTableView.RenderColumns[31].Display = false;
                griddetails.MasterTableView.RenderColumns[32].Display = false;

                //if (e.Item.RowIndex > -1)                                       // i comment this part but still not working
                //{
                RadComboBox ddlMT = new RadComboBox();
                ddlMT.ID = "ddlMT";
                   
                ddlMT.Filter = RadComboBoxFilter.Contains;
                ddlMT.DataSource = Bll.Bal_BindAllEmployeewithRole("ALL", Session["MTUseId"], e.Item.Cells[4].Text, e.Item.Cells[5].Text, "MT", null, null);
                ddlMT.DataTextField = "EmployeeName";
                ddlMT.DataValueField = "Empid";
                ddlMT.DataBind();
                e.Item.Cells[20].Controls.Add(ddlMT);

                RadComboBox ddlQA = new RadComboBox();
                ddlQA.ID = "ddlQA";
                   
                ddlQA.Filter = RadComboBoxFilter.Contains;
                ddlQA.DataSource = Bll.Bal_BindAllEmployeewithRole("ALL", Session["MTUseId"], e.Item.Cells[4].Text, e.Item.Cells[5].Text, "QA", null, null);
                ddlQA.DataTextField = "EmployeeName";
                ddlQA.DataValueField = "Empid";
                ddlQA.DataBind();
                e.Item.Cells[21].Controls.Add(ddlQA);

                RadComboBox ddlMT2 = new RadComboBox();
                ddlMT2.ID = "ddlMT2";
                  
                ddlMT2.Filter = RadComboBoxFilter.Contains;
                ddlMT2.DataSource = Bll.Bal_BindAllEmployeewithRole("ALL", Session["MTUseId"], e.Item.Cells[4].Text, e.Item.Cells[5].Text, "MT2", null, null);
                ddlMT2.DataTextField = "EmployeeName";
                ddlMT2.DataValueField = "Empid";
                ddlMT2.DataBind();
                e.Item.Cells[22].Controls.Add(ddlMT2);

                RadComboBox ddlQA2 = new RadComboBox();
                ddlQA2.ID = "ddlQA2";
                  
                ddlQA2.Filter = RadComboBoxFilter.Contains;
                ddlQA2.DataSource = Bll.Bal_BindAllEmployeewithRole("ALL", Session["MTUseId"], e.Item.Cells[4].Text, e.Item.Cells[5].Text, "QA2", null, null);
                ddlQA2.DataTextField = "EmployeeName";
                ddlQA2.DataValueField = "Empid";
                ddlQA2.DataBind();
                e.Item.Cells[23].Controls.Add(ddlQA2);

                RadComboBox ddlQC = new RadComboBox();
                ddlQC.ID = "ddlQC";
                  
                ddlQC.Filter = RadComboBoxFilter.Contains;
                ddlQC.DataSource = Bll.Bal_BindAllEmployeewithRole("ALL", Session["MTUseId"], e.Item.Cells[4].Text, e.Item.Cells[5].Text, "QC", null, null);
                ddlQC.DataTextField = "EmployeeName";
                ddlQC.DataValueField = "Empid";
                ddlQC.DataBind();
                e.Item.Cells[24].Controls.Add(ddlQC);

               
            }
            //}
        }
   
I think i am creating the control dynamic here it may be due to this. This code bind upto 971 records but after that it show error.

if there is another way to create it, tell me. I want to bind thru it server side not clientside bcoz it can't fullfill my need.

Eyup
Telerik team
 answered on 24 Jun 2016
3 answers
262 views

Hi

My DataForm displays data in edit mode just fine, with a selection of textboxs and RadDropDownList's.

The RadDropDownList bind via the RadDataForm1_ItemDataBound event.

 

But when I am in insert mode how do I populate/bind  my  RadDropDownList in code behind?

The ItemDataBound doesn't fire

 

Many Thanks

 

Mark

 

Eyup
Telerik team
 answered on 24 Jun 2016
1 answer
312 views

Hi

    I am using radscheduler, I need to  select multiple dates from the month view of scheduler, I would like to get start date and end date of my selection.

How is that possible in C#?

It is urgent therefore a quick response would be greatly appreciated.

Thanks

Ivan Danchev
Telerik team
 answered on 24 Jun 2016
1 answer
141 views

Hallo,
when I am use radgrid editmode=popup with a web user controll with insert action the template was displayed with empty field (no datarecord was bound).
For a better useibility I want to preset the template fields with default values. But how can I do this? To set the fields in the user control has no affect becaus it would be overitten after bounding to the empty insert record.

Harald

Eyup
Telerik team
 answered on 24 Jun 2016
1 answer
150 views

Is there some way to add a QueryString to the NavigateUrl parameter of a NavigationNode like ?ClientID=123

each node in my navigation needs to have the QS appended when the web form based on a master page that contains the <RadNavigation/> loads for a new client

I was thinking the codebehind of the .master could modify the NavigateUrl of each node?

david
Top achievements
Rank 1
 answered on 23 Jun 2016
1 answer
37 views

I have many telerik rad grids in my DNN project . It initialize with ability to have client side row selection with

<clientsettings>
      <Selecting AllowRowSelect="True" />
</clientsettings>

it is ok and in first load when my paging selector is on 10 object per grid selecting works fine , but when I change page size to 20 or 50 selecting suddenly stops working and I can not select row anymore . Can anyone help me with this ?

Pavlina
Telerik team
 answered on 23 Jun 2016
1 answer
246 views

I am using Telerik RadDiagram for building a diagram. The gray lines are over the shapes (requirements, development etc) in my diagram. Is there any way to put them behind the shapes?

// ... getting ready the shape objects ...
for (int i = 0, j = 0; i < monthCount + 1; i++, j = j + 2)
{
// ... getting ready the shape and connection objects...
RadDiagram1.ShapesCollection.Add(shapeForLines[j]);
RadDiagram1.ShapesCollection.Add(shapeForLines[j + 1]);
RadDiagram1.ConnectionsCollection.Add(monthLine[i]);
RadDiagram1.ShapesCollection.Add(labelMonth[i]);
}
for (int i = 0; i < 7; i++)
{
if (i < 6)
{
RadDiagram1.ShapesCollection.Add(shape[i]);
}
if (i < 7)
{
RadDiagram1.ShapesCollection.Add(label[i]);
}
}

Vessy
Telerik team
 answered on 23 Jun 2016
5 answers
63 views
I have tried setting the property for the filter window to sort the setbox here for the pivot grid

FilterWindow-SetBox-Sort="Ascending" 

Have also tried sorting from code behind (which does seem to sort the items) and then update the setbox but no matter what I try the items in the setbox list are always completely unsorted. I tried putting this code in multiple events but something must be firing after the fact to unsort the values or sort them based on groups. I want a clean alphabetical sort for all items in the list. Thanks

RadPivotGrid1.FilterWindow.SetBox.Sort = RadListBoxSort.Ascending;
RadPivotGrid1.FilterWindow.SetBox.SortItems();
RadPivotGrid1.FilterWindow.SetBox.DataBind();
Konstantin Dikov
Telerik team
 answered on 23 Jun 2016
1 answer
226 views

hi all, please help me. i have code below and it adds tab and pageview fine. but after 2 tab it will not add anymore and keep complaining that i'm trying to add control with same ID. i know i'm not adding the same ID. So please help me resolve this issue. thank you so much for your time

<script type="text/javascript">
        function OnClientTabSelecting(sender, eventArgs) {
            var tab = eventArgs.get_tab();
            if (tab.get_text() == "")
            {
                document.getElementById("div_AddTab").style.display = "block";
                eventArgs.set_cancel(true);
            }
            else
            {
                eventArgs.set_cancel(false);
            }
        }
    </script>
 
<div id="div_AddTab" style="display:none;">
        Tab Title: <telerik:RadTextBox ID="txt_TabTitle" runat="server" />
        Element Type: <telerik:RadComboBox ID="ddl_ElementType" runat="server" />
        <telerik:RadButton ID="btn_AddTab" runat="server" Text="Add Tab" />
 <div>
    <div>
        <telerik:RadTabStrip RenderMode="Lightweight" runat="server" ID="RadTabStrip1"  Orientation="HorizontalTop" Width="760"
             MultiPageID="RadMultiPage1" Skin="Windows7" OnClientTabSelecting="OnClientTabSelecting">
            <Tabs>
                <telerik:RadTab runat="server" Text="tab1" />
                <telerik:RadTab runat="server" Text="tab2" />
                <telerik:RadTab runat="server" Text="" ImageUrl="~/images/add.png" />
            </Tabs>
        </telerik:RadTabStrip>
        <telerik:RadMultiPage ID="RadMultiPage1" runat="server" Width="760" Height="380" SelectedIndex="0" OnPageViewCreated="RadMultiPage1_PageViewCreated">
            <telerik:RadPageView ID="RadPageView1" runat="server">
                test
            </telerik:RadPageView>
            <telerik:RadPageView ID="RadPageView2" runat="server">
                test 2
            </telerik:RadPageView>           
        </telerik:RadMultiPage>
    </div>

Protected Sub btn_AddTab_Click(sender As Object, e As EventArgs) Handles btn_AddTab.Click       
        AddPageView(Trim(txt_TabTitle.Text), ddl_ElementType.SelectedItem.Text)
        AddTab(Trim(txt_TabTitle.Text))
    End Sub
 
    Protected Sub RadMultiPage1_PageViewCreated(sender As Object, e As RadMultiPageEventArgs)
        Dim rad_Editor As RadEditor = New RadEditor
        Dim radSlider As New RadSlider
        Select Case ddl_ElementType.SelectedValue
            Case "T"
                rad_Editor.ID = "radEditor_" & Trim(txt_TabTitle.Text)
                e.PageView.Controls.Add(rad_Editor)
            Case "B"
 
            Case "N"
        End Select
    End Sub
 
    Private Sub AddTab(title As String)
        Dim tabTemplate = New TabTemplate()
        Dim tab As New RadTab() With { _
            .Text = title,
            .PageViewID = "pv" & title _
        }
        RadTabStrip1.Tabs.Insert((RadTabStrip1.Tabs.Count - 1), tab)
        RadTabStrip1.DataBind()
        RadTabStrip1.SelectedIndex = tab.Index
    End Sub
 
    Private Sub AddPageView(pvId As String, elementType As String)
        Dim pageView As RadPageView = New RadPageView()
        pageView.ID = "pv_" & pvId
        pageView.CssClass = "pageView"
        RadMultiPage1.PageViews.Add(pageView)
        RadMultiPage1.SelectedIndex = pageView.Index
 
    End Sub
Duy
Top achievements
Rank 1
 answered on 23 Jun 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?