Telerik Forums
UI for ASP.NET AJAX Forum
9 answers
563 views
Hi,

I am dumping the contents of the rad grid into a data table and am trying to find a control that is inside the item template of a grid template column without knowing what he control name is.

I am  looping through all the columns in the grid and based on the data type, performing some custom formatting before inserting the row into the data table.

My question is, if the column is a grid template column, how can I find the control that is inside the <Item Template> without actually knowing the name.

Below is the code I am using to loop through the grid.
Dim dr As DataRow
 For Each dataItem As GridDataItem In Me.rgvMainGrid.MasterTableView.Items
     dr = exportTable.NewRow
     For Each column As GridColumn In Me.rgvMainGrid.MasterTableView.Columns
         If column.Display = True Then
             Select Case column.ColumnType
                 Case "GridBoundColumn", "GridDropDownColumn", "GridDateTimeColumn", "GridNumericColumn", "GridCalculatedColumn"
                     strFields = strFields + IIf(strFields = Nothing, "", ",") + column.UniqueName.ToString + "," + column.HeaderText.ToString
                     Select Case column.DataType.ToString
                         Case "System.String"
                             If dataItem(column.UniqueName).Text.ToString = " " Then
                                 dr(column.UniqueName) = ""
                             Else
                                 dr(column.UniqueName) = "'" + dataItem(column.UniqueName).Text.ToString
                             End If
                         Case "System.Decimal", "System.Double", "System.Single"
                             If dataItem(column.UniqueName).Text.ToString = " " Then
                                 dr(column.UniqueName) = 0
                             Else
                                 dr(column.UniqueName) = FormatNumber(dataItem(column.UniqueName).Text.ToString, 2, TriState.False, TriState.False, TriState.False)
                             End If
                         Case "System.Int16", "System.Int32", "System.Int64", "System.Single"
                             If dataItem(column.UniqueName).Text.ToString = " " Then
                                 dr(column.UniqueName) = 0
                             Else
                                 dr(column.UniqueName) = FormatNumber(dataItem(column.UniqueName).Text.ToString, 0, TriState.False, TriState.False, TriState.False)
                             End If
                         Case "System.DateTime"
                             If dataItem(column.UniqueName).Text.ToString = " " Then
                                 dr(column.UniqueName) = ""
                             Else
                                 dr(column.UniqueName) = dataItem(column.UniqueName).Text.ToString
                             End If
                     End Select
                 Case "GridTemplateColumn"
 
                 Case Else
                     'Do Nothing
             End Select
         End If
 
     Next
     exportTable.Rows.Add(dr)
 Next

Thanks for your assistance.
Tracy
Tracy
Top achievements
Rank 1
 answered on 26 Sep 2013
1 answer
78 views
I am obviously very new to the .net world. Please forgive me if the solution is obvious btu goggling hasn't turned up any info I can apply directly to my situation. I am using Visual Studio 2010. I am creating a "start" project that includes all the things I need for any app on my site, including css, certain images, and external javascript files. 

When I export this project to a template, it does not include the Telerik assembly file for some reason, so When I start a new project from the exported template, It doesn't have the assembly file and I have to manually re-add the Telerik refernce.

What am I doing wrong? How can I fix this?

Thank You.
Ianko
Telerik team
 answered on 26 Sep 2013
1 answer
112 views
Hi,

Is there issue with latest telerik Control on IE 10 , recently we upgraded the application to work on IE with latest telerik control and now daily we are getting unexpected UI behavior which was not earlier.
When combo is disabled toggle image is not showing on UI , please see the attached screen

Thanks
Afroz khan
Hristo Valyavicharski
Telerik team
 answered on 26 Sep 2013
3 answers
160 views

I have a wizard-like screen that has several steps. The first step includes an async-upload. I have set the PostbackTriggers property so that only the submit button on the last step causes the file to be uploaded. This all works fine to persist the file upload through the postbacks associated with the Next/Previous buttons of the wizard, however, the way the wizard works is to hide/show panel controls depending on which step is currently being viewed. If I set the panel.visible property to false for the panel which contains the async-upload, I notice when I return to this step by setting panel.visible to true, the upload is gone. I have found one potential workaround by setting panel.Style("display") = "block" or "none" depending on whether I want to hide it or not and this seems to persist the upload. I would prefer to use the built-in asp.net visible property. I am wondering if this is a known limitation or am I doing something wrong?
Hristo Valyavicharski
Telerik team
 answered on 26 Sep 2013
3 answers
111 views

I am using the demo of the mega menu and now that I have it built one of the sub-menus I want to have it filled via a custom list. I put a literal in and can't access the literal. I am sure I am missing something simple. The menu section is below. Thanks, John


<telerik:RadMenuItem Text="Shows" PostBack="false">
                            <Items>
                                <telerik:RadMenuItem CssClass="Shows" Width="640">
                                    <ItemTemplate>
                                        <div id="ShowsWrapper" class="Wrapper">
                                            <h3>Show Information</h3>
                                            <div class="ShowsLeft">
                                                <asp:Literal runat="server" ID="LiteralCurrentShow"></asp:Literal>
                                            </div>
                                            <div class="ShowsRight">
                                                <asp:Literal runat="server" ID="LiteralUpcomingShows"></asp:Literal>
                                                <a class="moreLink" href="/Shows/">View all Shows</a>
                                                </div>
                                        </div>
                                    </ItemTemplate>
                                </telerik:RadMenuItem>
                            </Items>
                        </telerik:RadMenuItem>


Kate
Telerik team
 answered on 26 Sep 2013
1 answer
391 views

Hello,

I'm creating a 'dashboard' on which the user can dynamically add dock controls. Each dock control contains a certain usercontrol.

Using the examples from the Telerik site, I already have created the dashboard and the functionality to add dock controls. But when I add a usercontrol, I get a null reference exception form the usercontrol. The usercontrol itself contains several buttons, which are null when I call dockLayout.Controls.Add(dock);
I'm not sure, but I think it has to do with the state of the page lifecycle.

The dock-widget example (http://www.telerik.com/help/aspnet-ajax/dock-widgets.html) I've using is probably the way to solve this problem, but the example doesn't explain how LoadControl() should be implemented. Is this the missing link? If so, can you give an example code, based on the provided example?

<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <telerik:RadAjaxLoadingPanel runat="server" ID="ralpConfiguration">
    </telerik:RadAjaxLoadingPanel>
 
    <telerik:RadAjaxPanel runat="server" ID="rapConfiguration" LoadingPanelID="ralpConfiguration">
          <telerik:RadWindow ID="modalPopup" runat="server" Width="360px" Height="360px" Modal="true">
               <ContentTemplate>
                    <asp:DropDownList runat="server" ID="ddlControls" ></asp:DropDownList>
                    <asp:Button runat="server" ID="btnAddRadDock" Text="Add" />
               </ContentTemplate>
          </telerik:RadWindow>
     </telerik:RadAjaxPanel>
 
    <telerik:RadDockLayout ID="dockLayout" runat="server">
    </telerik:RadDockLayout>
</asp:Content>

protected override void OnPreInit(EventArgs e)
{
  base.OnPreInit(e);
  btnAddControl.Click += new EventHandler(btnAddControl_Click);
  btnAddRadDock.Click += new EventHandler(btnAddRadDock_Click);
  dockLayout.SaveDockLayout += new DockLayoutEventHandler(dockLayout_SaveDockLayout);
  dockLayout.LoadDockLayout += new DockLayoutEventHandler(dockLayout_LoadDockLayout);
 
  for (int i = 0; i < CurrentDockStates.Count; i++)
  {
    RadDock dock = new RadDock();
    dock.ID = string.Format("RadDock{0}", i);
    dock.ApplyState(CurrentDockStates[i]);
    dockLayout.Controls.Add(dock);
  }
}
 
protected void dockLayout_SaveDockLayout(object sender, DockLayoutEventArgs e)
{
  CurrentDockStates = dockLayout.GetRegisteredDocksState();
}
 
protected void dockLayout_LoadDockLayout(object sender, DockLayoutEventArgs e)
{
  foreach (DockState state in CurrentDockStates)
  {
    e.Positions[state.UniqueName] = state.DockZoneID;
    e.Indices[state.UniqueName] = state.Index;
  }
}
 
private void btnAddRadDock_Click(object sender, EventArgs e)
{
  RadDock dock = CreateRadDock();
  dock.Tag = ddlControls.SelectedValue;
  LoadWidget(dock);
// the following line will trigger the page load of the user control, which in turn returns the null ref exception on a button within the user control
  dockLayout.Controls.Add(dock);
}
 
private void LoadWidget(RadDock dock)
{
  if (string.IsNullOrEmpty(dock.Tag))
    return;
 
  GisMapControl gisMapControl = new GisMapControl();
  gisMapControl.IsFilterPanelVisible = false;
  gisMapControl.LocationLimit = 100;
  gisMapControl.FacilityLimit = 100;
 
  dock.ContentContainer.Controls.Add(gisMapControl);
}
 
private RadDock CreateRadDock()
{
  int docksCount = CurrentDockStates.Count;
  RadDock dock = new RadDock();
  dock.ID = string.Format("RadDock{0}", docksCount);
  dock.Title = string.Format("Dock {0}", docksCount);
  dock.Text = string.Format("Added at {0}", DateTime.Now);
  dock.UniqueName = Guid.NewGuid().ToString();
  dock.Width = Unit.Pixel(300);
  return dock;
}
Slav
Telerik team
 answered on 26 Sep 2013
2 answers
258 views
Hi,
I am using RadButton in aspx page. I set property Visible=false; Depanding Scenarios It will be Visible  from code behind file. I am getting Request.Form["__EVENTTARGET"] null value when i click on radbutton. 
For similar scenario I was replaced RadButton with link button with Vissible=false; I am getting client id for  Request.Form["__EVENTTARGET"] in page_load event.

Please give solution for my problem as soon as possible.
Prasad
Top achievements
Rank 1
 answered on 26 Sep 2013
1 answer
165 views
Actually I am using scheduler where I can track child activities, child will attend the activities or if he doesn't attend we can delete that task on that day.

As of now my I am able to do all these tasks using the scheduler control.

My problem is :

Per task we will charge some amount based on child age, I need to do these calculations in a database based on child attendance.
I need a database query to get child completed tasks based on date wise. If I can get these in table format in the database and I can do above logic.

As of now In Appointments table has a data in single line format (DTSTART:20130916T093000Z
DTEND:20130916T103000Z
RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR
EXDATE:20131008T093000Z,20131010T093000Z ). I need a query where I can get same gird data in the database.
Plamen
Telerik team
 answered on 26 Sep 2013
1 answer
616 views
Hi,
How to set a requiredfieldvalidator from code behind.any one can show me a sample?
 
Thanks
Erin
Princy
Top achievements
Rank 2
 answered on 26 Sep 2013
8 answers
1.2K+ views
Hi,

I am using radgrid grouping. i want to display the count in header based on grouping. i have attached image please check,
(ie) i want to display count same as footer count. please check the image,

i am using the code

 For Each item As GridGroupHeaderItem In rgDetailGroup.MasterTableView.GetItems(GridItemType.GroupHeader)
            Dim grpHdrText As String() = item.DataCell.Text.Split("-")
            item.DataCell.Text = (grpHdrText(0) + "-" + item.GetChildItems().Length.ToString)
        Next

This code returns count correctly if i selected one grouping. but selecting another grouping second header count looks good. but first header not shown correct count. please help for this one,

Thanks in Advance,
Dhamu.
Angel Petrov
Telerik team
 answered on 26 Sep 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?