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

Has anyone here ever successfully implement the scenario I stated above? I have tried several ways accomplish this starting from using the grid's OnPreRender Event to intercept values down to the more conventional FilterExpression method. Unfortunately Telerik has been extremely rigid in this area. I've scoured (practically) all over the web to find viable solution for this to no avail. It seems that telerik control do have some dead ends.
Bernard
Top achievements
Rank 2
 answered on 30 Jul 2013
1 answer
91 views

I am dynamically creating a Grid in Page_Init. I have set Edit Mode to equal Batch.  When the user hits the save changes button, I display a window which allows the user to capture some additional data and which point the user can save the changes or cancel. This part of my program works fine.  My problem occurs when I want to refresh the Grid after the user has applied the changes and closed the window.  I have tried adding the following javascript and code to my program which I execute it when the window closes. Works fine but the Grid does not refresh.

 

              function refreshGrid(arg) {

                  if (!arg) {

                      $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");

                  }

                  else {

                      $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindAndNavigate");

                  }

              }

    protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)

    {

        if (e.Argument == "Rebind")

        {

            RadGrid1.Rebind();

        }

        else if (e.Argument == "RebindAndNavigate")

        {

            DirectoryRefresh();

        }

    }

    void grid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)

    {

        RadGrid grid = (RadGrid)sender;

        if (SessionManager.GetCache().MarketChannels != null)

        {

            grid.DataSource = SessionManager.GetCache().MarketChannels;

        }

    }

    protected void DirectoryRefresh()

    {

        SessionManager.SetChangedValues(null);

        MarketDirectory directory = SessionManager.GetCurrentMarketDirectory();

        directory = null;

        LoadMarketChannelTable();

        //RadGrid1.DataSource = SessionManager.GetCache().MarketChannels;

        RadGrid1.Rebind();

    }

 

 

  I assumed that this was because my grid was not a control in the AjaxManager to update. Because I create my Grid in the program, I added my Grid to the Ajaxmanager in the PageLoad.  When I do this, the script I use to pop the window when the user hits the Save Changes Button does not execute. See highlighted code.

 

   protected void Page_Init(object sender, System.EventArgs e)

    {

        PopulateGridOnPageInit();

    }

    protected void Page_Load(object sender, EventArgs e)

    {

        RadGrid1 = (RadGrid)PlaceHolder1.FindControl("grdMarkets");

        RadAjaxManager1.AjaxSettings.AddAjaxSetting(RadAjaxManager1, RadGrid1);

        RadAjaxManager1.AjaxSettings.AddAjaxSetting(RadGrid1, RadGrid1);

    }

    protected void PopulateGridOnPageInit()

    {

        RadGrid grid = new RadGrid();

        //grid.ClientIDMode = System.Web.UI.ClientIDMode.Static;

        RadGrid1 = grid;

        string selectedValue = Master.Request.Form.Get(RadComboBox1.ClientID.Replace('_', '$'));

        grid.ID = "grdMarkets";

        grid.Width = Unit.Percentage(100);

        grid.AllowSorting = true;

        grid.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric;

        grid.AllowPaging = true;

        grid.Skin = "Web20";

        grid.MasterTableView.AutoGenerateColumns = false;

        grid.MasterTableView.EnableColumnsViewState = false;

        grid.MasterTableView.EditMode = GridEditMode.Batch;

        grid.MasterTableView.CommandItemTemplate = new MyCommandItemTemplate("gridCommands");

        grid.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top;

        grid.MasterTableView.CommandItemSettings.ShowCancelChangesButton = true;

      

        grid.MasterTableView.DataKeyNames = new string[] { "Id" };

        grid.MasterTableView.CommandItemSettings.ShowSaveChangesButton = true;

        grid.MasterTableView.BatchEditingSettings.EditType = GridBatchEditingType.Cell;

        grid.NeedDataSource += new GridNeedDataSourceEventHandler(grid_NeedDataSource);

        grid.BatchEditCommand += new GridBatchEditEventHandler(grid_BatchEditCommand);

        grid.AllowFilteringByColumn = true;

        if (selectedValue != null)

        {

            if ((SessionManager.GetCurrentMarket() == null) ||

                (selectedValue != SessionManager.GetCurrentMarket().Name))

            {

                SessionManager.SetCurrentMarket(selectedValue);

                hdMarket.Value = selectedValue;

                LoadMarketChannelTable();

            }

            DataTable dt = SessionManager.GetCache().MarketChannels;

            foreach (DataColumn dc in dt.Columns)

            {

                if (dc.ColumnName == "group")

                {

                    GridTemplateColumn boundColumn = new GridTemplateColumn();

                    boundColumn.ItemTemplate = new LabelTemplate(dc.ColumnName);

                    boundColumn.EditItemTemplate = new ComboBoxTemplate(dc.ColumnName);

                    boundColumn.DataType = dc.DataType;

                    boundColumn.HeaderText = dc.ColumnName;

                    boundColumn.SortExpression = dc.ColumnName;

                    boundColumn.DataField = dc.ColumnName;

                    grid.MasterTableView.Columns.Add(boundColumn);

                }

                else

                {

                    if (dc.DataType == typeof(bool))

                    {

                        GridCheckBoxColumn boundColumn = new GridCheckBoxColumn();

                        boundColumn.DataType = dc.DataType;

                        boundColumn.HeaderText = dc.ColumnName;

                        boundColumn.DataField = dc.ColumnName;

                        grid.MasterTableView.Columns.Add(boundColumn);

                        if ((dc.ColumnName == "id") || (dc.ColumnName == "channelID"))

                        {

                            boundColumn.Visible = false;

                        }

                    }

                    else

                    {

                        GridBoundColumn boundColumn = new GridBoundColumn();

                        boundColumn.DataType = dc.DataType;

                        boundColumn.HeaderText = dc.ColumnName;

                        boundColumn.DataField = dc.ColumnName;

                        grid.MasterTableView.Columns.Add(boundColumn);

                        if ((dc.ColumnName == "id") || (dc.ColumnName == "channelID"))

                        {

                            boundColumn.Visible = false;

                        }

                    }

                }

            }

           

 

        }

        PlaceHolder1.Controls.Add(grid);

        string script = "<script language='javascript' type='text/javascript'>function SaveChangesInGrid(sender, args) { " +

                "var grid = $find('" + grid.ClientID + "'); " +

                    "grid.get_batchEditingManager().saveChanges(grid.get_masterTableView());" +

                    "}</script>";

        ClientScript.RegisterStartupScript(this.GetType(), "SaveChanges", script);

    }

    void grid_BatchEditCommand(object sender, GridBatchEditingEventArgs e)

    {

       List<string> changedValues = new List<string>();

       SessionManager.SetChangedValues(null);

       DataTable dt = SessionManager.GetCache().MarketChannels;

       bool updateNeeded = false;

        foreach(GridBatchEditingCommand cmd in e.Commands)

        {

             if(cmd.Type == GridBatchEditingCommandType.Update)

             {

                // int editRowIdx = Int32.Parse(e.Item.ItemIndexHierarchical);

                 foreach(string columnName in cmd.NewValues.Keys)

                 {

                     int key = Convert.ToInt32(cmd.Item.GetDataKeyValue("Id"));

                     DataRow row = dt.Rows.Find(key);

                    

                     if((cmd.NewValues[columnName] != null) && (cmd.NewValues[columnName].ToString().Trim() != row[columnName].ToString().Trim()))

                     {

                         changedValues.Add(row["channelID"].ToString() + ";"  + columnName + ";" + cmd.NewValues[columnName].ToString());

                         row[columnName] = cmd.NewValues[columnName];

                         updateNeeded = true;

                        

                     }

                 }

             }

        }

        if (updateNeeded)

        {

            SessionManager.SetChangedValues(changedValues);

           string script = "<script language='javascript' type='text/javascript'>Sys.Application.add_load(showBatchChangeWindow);</script>";  // Doesn’t execute

            ClientScript.RegisterStartupScript(this.GetType(), "showWindow", script);

   

        }

    }

 

 

Any help would be appreciated.

 

Thanks!

 

Jayesh Goyani
Top achievements
Rank 2
 answered on 30 Jul 2013
2 answers
163 views
Hello to all,

My customer wants in timeline-view a change of background color behind die Group-Headers (at the left side of the Scheduler).
In the attached picture its the area which the arrows on top and bottom.

The resourcetype depends to a SqlDatasource and my idea was a own field in this SqlDataSource with die color-value as Integer.

Is this possible?
I'm writing in VB.

I've just implemented coloring of appointments based on values of a SqldataSource.

Thank to all!
Jürgen
Jürgen
Top achievements
Rank 1
 answered on 30 Jul 2013
3 answers
442 views
Hi All,

 I have an issue here . I have a datatable as datasource for a radgrid. I have faced issue with the border for the radgrid as some cell borders are not displayed. Refer 1.jpg file i have attached
 
I have changed my SQL query to handle the Null case.
SELECT
.....ISNULL
(KP.dbo.PH.qc,'') as qc,ISNULL(KP.dbo.PH.di,' ') as di
.....
.....
FROM KP.dbo.PH

But for my surprise when i remove the alias name cell border is coming up. But i need the alias name, since by adding ISNULL check the column header will go blank.


<telerik:RadGrid ID="RadGridInspection" CssClass="RadGridCustomClass" AllowSorting="false" AllowPaging="true" AllowFilteringByColumn="false"
                                                AutoGenerateColumns="false" runat="server" ClientSettings-EnableAlternatingItems="False" AlternatingItemStyle-BorderStyle="Solid" BorderStyle="Solid" EditItemStyle-BorderStyle="Solid" ItemStyle-BorderStyle="Solid">
                                                     <MasterTableView AutoGenerateColumns="False" >
                                                        <Columns >
                                                           <telerik:GridBoundColumn DataField="di" UniqueName ="di" HeaderText="DI"  ItemStyle-BorderColor="Gray" ItemStyle-BorderStyle="Solid">
                                                            </telerik:GridBoundColumn>
                                                            <telerik:GridBoundColumn DataField="ai" UniqueName ="ai" HeaderText="AI"  ItemStyle-BorderColor="Gray" ItemStyle-BorderStyle="Solid">
                                                            </telerik:GridBoundColumn>
                                                            <telerik:GridBoundColumn DataField="qc" UniqueName ="qc" HeaderText="QC"  ItemStyle-BorderColor="Gray" ItemStyle-BorderStyle="Solid">
                                                            </telerik:GridBoundColumn>
</Columns>
                                                    </MasterTableView>
                                                </telerik:RadGrid>
 

EVEN i have used prerender code in codebehind to handle if there is any blank cells.

Protected Sub RadGridInspection_PreRender(sender As Object, e As EventArgs) Handles RadGridInspection.PreRender
        For Each dataItem As GridDataItem In RadGridInspection.Items
            For Each col As GridColumn In RadGridInspection.Columns
                'If dataItem(col.UniqueName).Text = String.Empty Then
                If String.IsNullOrEmpty(dataItem(col.UniqueName).Text) Or dataItem(col.UniqueName).Text = " " Then
                    dataItem(col.UniqueName).Text = " "
                End If
            Next
        Next
    End Sub


Kindly let me know how to handle this scenario..

Thanks in advance



Suresh Krishna
Top achievements
Rank 1
 answered on 30 Jul 2013
5 answers
916 views

Hi All,

I have requirement in my project to select a required folder path using folder browse window.

After selecting the path, file name is appended and the file is generated in the selected path

How to implement it in Telerik

Thanks In Advance

Shinu
Top achievements
Rank 2
 answered on 30 Jul 2013
5 answers
129 views

<
Rad:RadGrid Height="350px" Width="100%" ID="RadGridFields" Skin="Windows7" BorderStyle="Solid" runat="server" AllowPaging="True"
    GridLines="None" AllowMultiRowEdit="true" AllowAutomaticUpdates="True" AllowSorting="True" AllowMultiRowSelection="false"
    OnUpdateCommand="RadGridFields_UpdateCommand" OnNeedDataSource="RadGridFields_NeedDataSource" OnItemDataBound="RadGridFields_ItemDataBound" AutoGenerateColumns="false">
 
    <MasterTableView TableLayout="Fixed" DataKeyNames="LabelText" EditMode="InPlace" AllowPaging="false" Width="100%" NoMasterRecordsText="">
      <Columns>
        <Rad:GridEditCommandColumn HeaderText="Edit" HeaderStyle-Width="55px" ButtonType="ImageButton" EditText="Edit" UniqueName="EditCol" />
 
        <Rad:GridTemplateColumn UniqueName="LabelText" HeaderText="LabelText" HeaderStyle-Width="200px" DataField="LabelText">
          <ItemTemplate>
            <%#DataBinder.Eval(Container.DataItem, "LabelText")%>
          </ItemTemplate>
          <EditItemTemplate>
            <Rad:RadTextBox runat="server" ID="textLabel" AutoPostBack="true" Height="140px" Width="200px" />
          </EditItemTemplate>
        </Rad:GridTemplateColumn>
 
        <Rad:GridTemplateColumn UniqueName="Mandatory" HeaderText="Mandatory" HeaderStyle-Width="80px" DataField="Mandatory">
          <ItemTemplate>
            <%#DataBinder.Eval(Container.DataItem, "Mandatory")%>
          </ItemTemplate>
          <EditItemTemplate>
            <Rad:RadComboBox runat="server" ID="comboMandatory" AutoPostBack="true" HighlightTemplatedItems="true" Height="140px" Width="80px" DropDownWidth="200px" OnSelectedIndexChanged="comboMandatory_SelectedIndexChanged" >
            <Items>
               <Rad:RadComboBoxItem Value="False" Text="False" />
               <Rad:RadComboBoxItem Value="True" Text="True" />
            </Items>
            </Rad:RadComboBox>
          </EditItemTemplate>
        </Rad:GridTemplateColumn>
 
        <Rad:GridTemplateColumn UniqueName="DefaultText" HeaderText="DefaultText" HeaderStyle-Width="200px" DataField="DefaultText">
          <ItemTemplate>
            <%#DataBinder.Eval(Container.DataItem, "DefaultText")%>
          </ItemTemplate>
          <EditItemTemplate>
            <Rad:RadTextBox runat="server" ID="textDefault" AutoPostBack="true" Height="140px" Width="200px" />
          </EditItemTemplate>
        </Rad:GridTemplateColumn>
      </Columns>
    </MasterTableView>
 
    <ClientSettings>
      <ClientEvents OnRowDblClick="editThisRow" OnCommand="onClientCommand" />
      <Scrolling AllowScroll="true" ScrollHeight="100%" />
      <Selecting AllowRowSelect="true" />
    </ClientSettings>
  </Rad:RadGrid>

I want to show some data on a radgrid. I want all the columns texts to be editable from the beginning. Later I want to save the data. Above I have given my code in ascx control. Noe this is my code in cs page 

protected void Page_Load(object sender, EventArgs e)
  {
    if (!IsPostBack)
    {
     RadGridFields.DataSource = gridTable;
    RadGridFields.DataBind();
 
    foreach (GridDataItem item in RadGridFields.MasterTableView.Items)
    {
      item.Edit = true;
    }
    RadGridFields.Rebind();
      }
    }
  }

When I run this all the columns become editable. But all the checkboxes contain false value and all textboxes contain blank value. I want previous datas to be there and from that data user can edit. If I remove 
foreach (GridDataItem item in RadGridFields.MasterTableView.Items)
    {
      item.Edit = true;
    }
    RadGridFields.Rebind();
      }

this part from code then all datas are there..when I double click on the then the row's data vanishes. Need Help..Thanks in advanced
Princy
Top achievements
Rank 2
 answered on 30 Jul 2013
2 answers
161 views
Hi Telerik,
I have a rad numeric textbox sitting within a radtabstrip and multipage.
The multipage is set to renderSelectedPageOnly and hence the tabstrip is set to autopostback.

I have found an issue with this however.
If I change the number in the numeric textbox and then switch tabs the new number is lost upon switching back to the original tab.
Viewstate is of course enabled.
If I alter the number, then move the focus to another element prior to switching tabs the change is retained.
I find this to be a big problem and am currently looking at putting a handler to onclienttabselecting to rectify the issue.

Note I have tested this same behaviour against a regular asp:textbox and the change is retained as I would expect.

Regards,
Matt
Matthew Botting
Top achievements
Rank 1
 answered on 30 Jul 2013
5 answers
152 views
I have special days added to the RadCalendar which is multiselect, and for those special days I set IsSelectable = true.
When I unselect the selected dates using unselectDates client side function, all other dates are unselected except the special days.
using following code to unselect;


RadCalendar1.unselectDates(RadCalendar1.get_selectedDates())


I am stuck, what should I do?


Regards,
Kash
Raoul Guenette
Top achievements
Rank 1
 answered on 29 Jul 2013
2 answers
330 views
We have a request to hide the page numbers and the page size but not the PagerTextFormat when the amount of records is less than the pagesize itself.  In other words, if there are 7 records but the minimum PageSize is 10, the Page Count and the Page Mode should not be visible.  And changing the PagerStyle AlwaysVisible to False hides everything.  

Can this be done without using CSS display none to all elements in the Pager Style?

Thank you,
Julio
Monte
Top achievements
Rank 1
 answered on 29 Jul 2013
1 answer
198 views
Hi,
I want to know if there is sample application which use gauges and charts in a responsive html5 + css3 interface?
I want to see it in action, how the UI resized itself when the screen is small
etc...

I have to create a dashboard which fit perfectly on any device.

so does the Kendo UI can do this?
I don't see any demo like the competitors does...
Danail Vasilev
Telerik team
 answered on 29 Jul 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?