Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
154 views
Hello,

I have added RadGrid on ASPX page and I want to add columns dynamically to this RadGrid.
I am facing problem like if page gets refreshed it creates some extra columns at the end. It should maintain same columns if i sort/change page or any postback occurs  because of asp.net controls.
Here is the code that I am using.

ZZZ.BL.ReportsBL reportBl = newZZZ.BL.ReportsBL();
       protected void Page_Init(object source, System.EventArgs e)
       {
               RadGrid1.MasterTableView.Columns.Clear();
               BuildGridColumns();
        
       }
       protected void Page_Load(object sender, EventArgs e)
       {
           if (!IsPostBack)
           {
               drpBillingCycles.DataSource = reportBl.GetBillingCycles(37);
               drpBillingCycles.DataBind();
           }
       }
       protected void drpBillingCycles_SelectedIndexChanged(object sender, EventArgs e)
       {
           int PageCount = 0;
           System.Data.DataTable cd = new System.Data.DataTable();
           RadGrid1.VirtualItemCount = PageCount;
           RadGrid1.DataSource = reportBl.GetReportData("325012", 37, RadGrid1.CurrentPageIndex, RadGrid1.PageSize, out PageCount);
           RadGrid1.DataBind();
       }
       protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
       {
           int PageCount = 0;
            RadGrid1.VirtualItemCount = PageCount;
           RadGrid1.DataSource = reportBl.("325012", 37, RadGrid1.CurrentPageIndex, RadGrid1.PageSize, out PageCount);
           //RadGrid1.DataBind();
       }
       private void BuildGridColumns()
       {
           RadGrid1.MasterTableView.Columns.Add(GetGridBoundColumn("PhoneNumber","Phone Number"));
           RadGrid1.MasterTableView.Columns.Add(GetGridBoundColumn("UserName", "Phone User Name"));
           RadGrid1.MasterTableView.Columns.Add(GetGridBoundColumn("EmpId", "Employee Id"));
           RadGrid1.MasterTableView.Columns.Add(GetGridBoundColumn("Department", "Radio Number"));
           
       }
       private GridBoundColumn GetGridBoundColumn(string DataField,string HeaderText)
       {
           GridBoundColumn boundColumn1 = new GridBoundColumn();
           boundColumn1.DataField = DataField;
           boundColumn1.UniqueName = DataField;
           boundColumn1.SortExpression = DataField;
           boundColumn1.HeaderText = HeaderText;
           return boundColumn1;
       }

Chetan
Top achievements
Rank 1
 answered on 29 Mar 2013
1 answer
108 views
When I have grouped a grid, with nested table, in columns and in the prerender event i hided some of gruped results happen that remain a spaces in the grid.
I'm try in all ways to remove that spaces but without success.
I see that the spaces disappear when I open and collapse a grouped row.
In the attached file can you see the result's grid.
This is the code.

For Each item As GridGroupHeaderItem In gridTelerik.MasterTableView.GetItems(GridItemType.GroupHeader)

item.Expanded = False

Dim groupDataRow As DataRowView = CType(item.DataItem, DataRowView)

If item.DataCell.Text.IndexOf("Partita:") > -1 Then

item.DataCell.Text = item.DataCell.Text.Replace(item.DataCell.Text.Substring(9, 8), "")

Dim StrdtReverse As String = item.DataCell.Text.Substring(item.DataCell.Text.Length - 10, 10)

Dim StrdtReverseConcat As String = String.Concat(StrdtReverse.Substring(6, 4), StrdtReverse.Substring(3, 2), StrdtReverse.Substring(0, 2))

Dim dtRowPartita() As DataRow = dataTableEstrattoConto.Select(String.Concat("Partita='", StrdtReverseConcat, item.DataCell.Text.Replace("Partita: ", ""), "'"))

For ik As Integer = 0 To dtRowPartita.Length - 1

totaleNettoPartita += Convert.ToDecimal(dtRowPartita(ik).Item("Importonetto"))

Next

item.DataCell.Text = String.Concat("Saldo partita: <b>", String.Format("{0:n2}", totaleNettoPartita), "</b>")

totaleNettoPartita = 0

End If

'item.DataCell.Text = "$" + groupDataRow("Cliente").ToString() + " (" + groupDataRow("Importonetto").ToString() + ")"

If item.DataCell.Text.IndexOf("Cliente:") > -1 Then

Dim dtRowCliente() As DataRow = dataTableEstrattoConto.Select(String.Concat("Cliente='", item.DataCell.Text.Replace("Cliente: ", ""), "'"))

For ik As Integer = 0 To dtRowCliente.Length - 1

totaleNetto += Convert.ToDecimal(dtRowCliente(ik).Item("Importonetto"))

totaleRitenuta += Convert.ToDecimal(dtRowCliente(ik).Item("Importoritenuta"))

totaleLordo += Convert.ToDecimal(dtRowCliente(ik).Item("Importolordo"))

totaleImponibileRitenuta += Convert.ToDecimal(dtRowCliente(ik).Item("Imponibileritenutaacconto"))

Next

item.DataCell.Text = String.Concat(groupDataRow("Cliente").ToString().TrimStart, "<br> <b>TOTALI: Importo lordo:</b> ", String.Format("{0:n2}", totaleLordo), _

" - <b>Imponibile ritenuta acconto:</b> ", String.Format("{0:n2}", totaleImponibileRitenuta), _

" - <b>Importo ritenuta:</b> ", String.Format("{0:n2}", totaleRitenuta), " - <b>Importo netto:</b> ", String.Format("{0:n2}", totaleNetto))

If totaleLordo = 0 Then

If (Request.QueryString("st") Is Nothing) Or _

(Not Request.QueryString("st") Is Nothing AndAlso Request.QueryString("St").ToString <> "1") Then

'se le partite si pareggiano tra di loro, perch ad es. c' una nota di credito in un altra partita

'non rendo visibile il tab

item.Visible = False

item.Display = False

item.Expanded = False

End If

End If

totaleGenerale += totaleNetto

totaleLordo = 0

totaleNetto = 0

totaleRitenuta = 0

totaleImponibileRitenuta = 0

End If

Next

Kostadin
Telerik team
 answered on 29 Mar 2013
5 answers
293 views
Hi,

In my RadGrid 10 rows are displaying while clicking the linkbutton which is outside the grid my grid should display 20 rows per page. Any one can help me on this.

Regards,
Nithya
Angel Petrov
Telerik team
 answered on 29 Mar 2013
2 answers
105 views
Hello,

How to use both InPlace and PopUp edit mode in same grid? 

I have the functionality like "adding new rows" and "editing the existing row", I wish to have PopUp for Adding new rows and InPlace for Editing the existing row.

Please let me know in which way I can able to accompolish this.

Thank You
Regards
Ganapathy
Ganapathy
Top achievements
Rank 1
 answered on 29 Mar 2013
2 answers
613 views
Hello,

I have disabled checkboxes within the rad grid on the server side and I am unable to enable them via javascipt.  How can this be achieved?

I use this code to enable/disable checkboxes via JavaScript
function SelectDependentRoles(checked, readerCheckbox, dropboxCheckbox) {
      if (checked) {
          readerCheckbox.checked = checked;
          readerCheckbox.disabled = true;
          dropboxCheckbox.checked = checked;
          dropboxCheckbox.disabled = true;
      }
      else {
          readerCheckbox.checked = checked;
          readerCheckbox.disabled = false;
          dropboxCheckbox.checked = checked;
          dropboxCheckbox.disabled = false;
      }
  }

This code above works just fine until i disable the checkboxes on the server:

private void EnableCheckboxes()
        {
            foreach (GridDataItem row in dgLoginRequest.MasterTableView.Items)
            {
                var chbxReader = (CheckBox)row.FindControl("chbxReader");
                var chbxRKDropbox = (CheckBox)row.FindControl("chbxRKDropbox");
                var chbxShare = (CheckBox)row.FindControl("chbxShare");
  
                chbxReader.Enabled = !chbxShare.Checked;
                chbxRKDropbox.Enabled = !chbxShare.Checked;
            
        }

Then when I try to run the javascript code it puts the checkboxes in a wierd state.  I have attached a screen shot.  How do I enable these checkboxes again via javascript?
Robert
Top achievements
Rank 1
 answered on 28 Mar 2013
4 answers
199 views
I have a webpage that has two buttons.
Button 1 : When you click on this button it opens up a modal window.
Button 2: Is to save the page data.

Scenario: When We click on Button1 it opens up a modal window..
 Then We close the window using windows close icon. (X)
 Then when we save the page(By clicking on button 2) 
 The modal window popus up again.

Please advise how can I avoid poping up the modal window on save button click.

Here is the code of Button1 click event

   protected void Button1_Click(object sender, EventArgs e)
    {
        RadWindow _menuwindow = new RadWindow();
        _menuwindow.NavigateUrl = "~/Console/L/Details.aspx";
        _menuwindow.VisibleOnPageLoad = true;
        _menuwindow.ShowContentDuringLoad = true;
        _menuwindow.Style.Value = "z-index:7010;";
        _menuwindow.ID = "Button1";
        _menuwindow.Modal = true;
        _menuwindow.Height = 600;
        _menuwindow.Width = 900;
        _menuwindow.DestroyOnClose = true;
        _menuwindow.Title = "Button1";
        CathWindowManager.Windows.Add(_menuwindow);
    }

Thanks.
Gauri
Top achievements
Rank 1
 answered on 28 Mar 2013
11 answers
256 views
Dear Form,

I have an ajaxified radgrid that I successfully export to Excel, however, after I close the excel file and return to the web page, all the controls are frozen and I have to refresh the page to get anything working. How can I correct that?

I am working in VS2008 with Q2 2010 release, C#.

Thanks,
Celeste
Howard
Top achievements
Rank 1
 answered on 28 Mar 2013
1 answer
118 views
I can't figure out what I am doing wrong.  I am trying to use a custom skin with the RadSkinManager following the instructions here: http://www.telerik.com/help/aspnet-ajax/skinmanager.html

My StyleSheetManager:

<telerik:RadStyleSheetManager runat="server" ID="rssMan" EnableStyleSheetCombine="false"  />

My RadSkinManager:

    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="false" >
        <Skins>
            <telerik:SkinReference Path="MySkins" />
        </Skins>
        <TargetControls>
            <telerik:TargetControl ControlsToApplySkin="RadGrid" Skin="DonorPortalDefault" />
            <telerik:TargetControl ControlsToApplySkin="RadCalendar" Skin="DonorPortalDefault" />
            <telerik:TargetControl ControlsToApplySkin="RadMenu" Skin="DonorPortalDefault" />
            <telerik:TargetControl ControlsToApplySkin="RadWindowManager" Skin="DonorPortalDefault" />
            <telerik:TargetControl ControlsToApplySkin="RadToolBar" Skin="DonorPortalDefault" />
            <telerik:TargetControl ControlsToApplySkin="RadColorPicker" Skin="DonorPortalDefault" />
            <telerik:TargetControl ControlsToApplySkin="RadDatePicker" Skin="DonorPortalDefault" />
            <telerik:TargetControl ControlsToApplySkin="RadEditor" Skin="DonorPortalDefault" />
            <telerik:TargetControl ControlsToApplySkin="RadTabStrip" Skin="DonorPortalDefault" />
            <telerik:TargetControl ControlsToApplySkin="RadUpload" Skin="DonorPortalDefault" />
            <telerik:TargetControl ControlsToApplySkin="RadDateInput" Skin="DonorPortalDefault" />
            <telerik:TargetControl ControlsToApplySkin="RadComboBox" Skin="DefaDonorPortalDefaultult" />
            <telerik:TargetControl ControlsToApplySkin="RadAjaxLoadingPanel" Skin="DonorPortalDefault" />
        </TargetControls>
    </telerik:RadSkinManager>

My web.config:

    <appSettings>
    <add key="Telerik.Web.UI.StyleSheetFolders" value="~/MySkins" />
    <add key="Telerik.EnableEmbeddedSkins" value="false" />
    </appSettings>


I have at the root of my project a MySkins Folder, which inside has a folder DonorPortalDefault, and then I have css files named for example "Grid.DonorPortalDefault.css"

For additional good measure on my control I have put EnableEmbeddedSkins="false" Skin="DonorPortalDefault"

Yet when the page is rendered a stylesheet link is not placed on the page, and I get un-skinned controls.

I can't figure out what else I am doing wrong.



Nicholas Walker
Top achievements
Rank 1
 answered on 28 Mar 2013
1 answer
244 views
Hallo,

http://www.telerik.com/help/aspnet-ajax/calendar-styles.html 
http://www.telerik.com/help/aspnet-ajax/calendar-css-skin-file-selectors.html

To set the z-index after referring to url(s) above I tried these three classes but they seemed to to be effective. FYI - I also tried to use !important

 .RadCalendar , .rcTimePopup, rcCalPopup  & .rcHover

Reason:

I have a data entry form that I am genertaing dynamically and upon submit, the user sees result in the PDF Viewer on the right, but sometimes the Calendar Popup and/or drop-down, is if wider than uderlaps the Adobe's PDF Viewer. I certainly would like to use CSS selectors

Browser : IE 9 / W7

Code:

.RadCalendar{
    z-index: 2147483647;
    background-color: Aqua;
}
.rcTimePopup {
    z-index: 2147483647;
}
.rcHover {
    z-index: 2147483647;
    background-color: Aqua;
}


Thanks,
-Aarsh
Galin
Telerik team
 answered on 28 Mar 2013
2 answers
86 views
I have a programmatically rendered chart getting its information from Telerik date controls and dropdown. When I set date controls and drop downs to their values, the chart renders correctly. When I change the date and click my button to render the chart again, the chart maintains the previous informaiton. I debugged the code and the sql is getting the correct dates but the chart is still rendering the previous dates. Any thing I am missing here regarding the rendering process?
Rick
Top achievements
Rank 1
 answered on 28 Mar 2013
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?