Telerik Forums
UI for ASP.NET AJAX Forum
6 answers
346 views
Hi i am using radgrid.
I have two questions regarding this.

I have different dataset and single grid.
so I have not defined columns in the grid.
Columns are generated through the dataset columns.

1. Now i want to hide the first column of the grid.
2. I want to add a column for deleting the record.

How can i do this?
Please suggest me some idea...
swagatika
Top achievements
Rank 1
 answered on 25 Nov 2014
0 answers
161 views
I was recently given support duties on a DotNetNuke Pro system that uses Telerik controls.  We are having an error for customers on IE 11 and we were able to find the source.  In the "Telerick.Web.Ui.WebResource.axd file:

1. There is a "MicrosoftAjax.js" section at the top of the file that initializes a Sys.Browser.agent variable, then checks to see if it is Internet Explorer by looking for " MSIE " in the useragent string - since IE 11 does not use " MSIE " in useragent the browser stays undefined.

2. In the next "MicrosoftAjaxWebForms.js" section there is a function that checks if Sys.Browser.agent is equal to Sys.Browser.InternetExplorer, and if it is uses AttachEvent() to register a click handler.  Since Sys.Browser.agent was not identified as IE 11, at this point the code works properly would call document.AddEventListener(), which IE 11 supports.

3. Further down in the AXD there is a "START Telerik.Web.UI.Common.Core.js" section.  In this section there is a line of code that reads
    
 if(navigator.userAgent.indexOf("Trident")>-1&&navigator.userAgent.indexOf("MSIE")==-1){Sys.Browser.agent=Sys.Browser.InternetExplorer;


...this line changes Sys.Browser.agent to equal Sys.Browser.InternetExplorer, which causes the function in #2 above to throw an error (since AttachEvent is not available in IE11). 

Any ideas on how we resolve this issue?  Basically we need a way to either update the AttachEvent() test or stop the Telerik section that sets Sys.Browser.Agent.  Thanks.
Biz
Top achievements
Rank 1
 asked on 24 Nov 2014
4 answers
136 views
Hello,

I'm working on an application which needs to have an offline portion. We've used RadControls to date for the rest of the site interface. So, we'd like to keep the look and feel as similar as possible for the offline portion. 

We aren't doing anything crazy. Just need a couple RadToolBars and RadGrids. We've managed to get everything working including populating grids and controlling toolbars based on data saved in things like LocalStorage and IndexedDB. The only piece left is making the code not dependent on a script that is generated at runtime. When turning on AppCache references to "WebReference.axd?d=..." break because 

I have managed to get it completely working by manually caching the numerous "WebReference.axd?d=" files, but I do not like this solution as the file names in the manifest are static.

Is there a better way to do this with RadControls?
Philip
Top achievements
Rank 1
 answered on 24 Nov 2014
4 answers
88 views
I have a number of nearly identical grids (different in the database tables only) that are all working exactly correct.  However, I have one grid that simply refuses to go past page 1.  The display file contents and the code behind contents are both attached below.  There is also a screen capture of page 1 and then subsequent pages (doesn't matter which one I include, they all look the same).

If anyone has any ideas why this page will not page forward but all of the others that essentially identical do would be most appreciated!

Thanks!

<%@ Page Title="" Language="C#" MasterPageFile="~/masters/BrokerPlusMstr.Master" AutoEventWireup="true" CodeBehind="OfcSourceList.aspx.cs" Inherits="BrokerPlusOffice.OfcSourceList" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
 
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h3>
        Sources
    </h3>
    <p>
        The Sources codes are used to describe how real estate business leads were directed to your company.
    </p>
<div class="container">
    <div class="row10">
        <div class="one column" >
              
        </div>
        <div class="fourteen columns" >
            <telerik:RadGrid ID="RadGrid1" runat="server" ></telerik:RadGrid>
        </div>
        <div class="one column" >
              
        </div>
    </div>
</div>
<br />
<div class="container">
    <div class="row10">
        <div class="sixteen columns" style="text-align: center;" >
            <telerik:RadButton ID="CreateNew" runat="server" Text="Create New" CausesValidation="False" ToolTip="Displays a form for adding a new Source to the database." UseSubmitBehavior="True" OnClick="CreateNew_Click" />
            <telerik:RadButton ID="CloseMe" runat="server" Text="Close Window" CausesValidation="False" ToolTip= "Closes this window." UseSubmitBehavior="False" OnClientClicked="closemenow" />
        </div>
    </div>
</div>
<div class="container">
    <div class="row10">
        <div class="sixteen columns" style="text-align: center;">
            <asp:Label ID="PageErrors" runat="server" Font-Bold="True" ForeColor="#C00000" Width="95%"></asp:Label>
        </div>
    </div>
</div></asp:Content>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.Common;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Web.Security;
using System.Configuration;
using System.Collections;
using Telerik.Web.UI;
using ApplDB = PublixDBCS10;
using BrokerPlusDBCS10;
 
namespace BrokerPlusOffice
{
    public partial class OfcSourceList : Common.THDiBasePage
    {
        protected void Page_Init(object sender, System.EventArgs e)
        {
            if (!Page.IsPostBack)
            {
 
                //  Get the users form security rules and set the buttons accordingly
                string sUserFormRules = Convert.ToString(Session["UserBrokerPlusFormsRules"]);
                string sRule = sUserFormRules.Substring(40, 1);
 
                switch (sRule)
                {
                    case "0":
                        //  the user is not authorized for this page, so send them to the error page
                        Response.Redirect("~/UserNotAuthorized.aspx");
                        break;
                    case "1":
                        //  The user is only authorized for read-only activities, so set the buttons accordingly
                        this.CreateNew.Enabled = false;
                        break;
                    case "2":
                        //  The user is authorized to update data, so leave the buttons as is
                        break;
                }
 
                GridHyperLinkColumn hypercolumn = null;
                GridBoundColumn boundcolumn = null;
 
                RadGrid1.ID = "RadGrid1";
                RadGrid1.EnableViewState = false;
                RadGrid1.NeedDataSource += new Telerik.Web.UI.GridNeedDataSourceEventHandler(RadGrid1_NeedDataSource);
                RadGrid1.Width = Unit.Percentage(100);
                RadGrid1.PageSize = 15;
                RadGrid1.AllowPaging = true;
                RadGrid1.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric;
                RadGrid1.AutoGenerateColumns = false;
                RadGrid1.AllowFilteringByColumn = true;
                RadGrid1.ExportSettings.ExportOnlyData = true;
                RadGrid1.ExportSettings.IgnorePaging = true;
                RadGrid1.ExportSettings.HideStructureColumns = true;
                RadGrid1.ExportSettings.OpenInNewWindow = true;
                RadGrid1.MasterTableView.CommandItemSettings.ShowExportToCsvButton = false;
                RadGrid1.MasterTableView.CommandItemSettings.ShowExportToExcelButton = false;
                RadGrid1.MasterTableView.CommandItemSettings.ShowExportToPdfButton = false;
                RadGrid1.MasterTableView.CommandItemSettings.ShowExportToWordButton = false;
                RadGrid1.MasterTableView.CommandItemSettings.ShowAddNewRecordButton = false;
                RadGrid1.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None;
                RadGrid1.MasterTableView.Width = Unit.Percentage(100);
 
                RadGrid1.MasterTableView.DataKeyNames = new string[] { "Source" };
 
                hypercolumn = new GridHyperLinkColumn();
                hypercolumn.HeaderText = "Edit";
                hypercolumn.UniqueName = "Source";
                hypercolumn.Text = "<img border=\"0\" alt=\"View\" src=\"../Icons/pencil_16.png\" />";
                hypercolumn.DataNavigateUrlFields = new string[] { "Source" };
                hypercolumn.DataNavigateUrlFormatString = "OfcSourceEdit.aspx?M=Y&K=" + "{" + "0" + "}";
                RadGrid1.MasterTableView.Columns.Add(hypercolumn);
 
                hypercolumn = null;
 
                boundcolumn = new GridBoundColumn();
                boundcolumn.UniqueName = "SourceText";
                boundcolumn.DataField = "SourceText";
                boundcolumn.HeaderText = "Source";
                boundcolumn.Visible = true;
                RadGrid1.MasterTableView.Columns.Add(boundcolumn);
 
                boundcolumn = null;
 
                RadGrid1.AllowPaging = Convert.ToBoolean(Session["ShowListsWithPaging"]);
 
            }
        }
 
        public DataTable GetDataTable()
        {
            String ConnString = System.Configuration.ConfigurationManager.ConnectionStrings["BrokerPlus"].ConnectionString;
            DataTable dt = new DataTable();
            using (SqlConnection sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings["BrokerPlus"].ConnectionString))
            {
                using (SqlCommand cmd = new SqlCommand("Sources_GetAllBySource_Account", sqlcon))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add(new SqlParameter("@Source_Account", Convert.ToInt32(Session["UserAccount"])));
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dt);
                        return dt;
                    }
                }
            }
        }
 
        private void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            (source as RadGrid).DataSource = GetDataTable();
        }
 
        protected void CreateNew_Click(object sender, EventArgs e)
        {
            Response.Redirect("OfcSourceEdit.aspx?M=N&K=");
        }
    }
}

Lynn
Top achievements
Rank 2
 answered on 24 Nov 2014
5 answers
135 views
Bookmark Range is coming up with additional span text when linked with Heading Range.
Heading range comes with span text which is expected. But, we do not want the bookmark range to come up with additional span text.

BookmarkRangeStart, BookmarkRangeEnd, HeadingRangeStart, HeadingRangeEnd are derived from FieldRangeStartBase, FieldRangeEndBase,  ContentRangeStartBase, ContentRangeEndBase, AnnotationRangeStart and AnnotationRangeEnd.

Below is sample code:
BookmarkRangeStart bookMarkRangeStart = new BookmarkRangeStart("bookmark1";
BookmarkRangeEnd bookMarkRangeEnd = new BookmarkRangeEnd();
bookMarkRangeEnd.PairWithStart(bookMarkRangeStart);

HeadingRangeStart headingRangeStart = new HeadingRangeStart();
HeadingRangeEnd headingRangeEnd = new HeadingRangeEnd();
headingRangeEnd.PairWithStart(headingRangeStart);

paragraph.Inlines.Add(bookMarkRangeStart);
paragraph.Inlines.Add(headingRangeStart);
paragraph.Inlines.Add(spanSelectedText);
paragraph.Inlines.Add(headingRangeEnd);                   
paragraph.Inlines.Add(bookMarkRangeEnd);
Mihail
Telerik team
 answered on 24 Nov 2014
5 answers
281 views
I've a bit of a problem with Telerik radcomboboxes not updating properly on an aspx page. Essentially a user picks a choice 'yes' or 'no' from radcombobox 1. If the user chooses 'yes' then radcombobox 2 should show and radcombobox 3 should be hidden; if the user chooses 'no' then radcombobox 3 should show and radcombobox 2 should be hidden.

The code behind is vb.net. On the aspx page, combo box 1 is ajaxed and supposed to update the other two radcomboboxes. In the code behind in the SelectedIndexChanged sub for radcombobox 1, the 'visible' property of the radcombobox 2 and 3 are swapped depending on the user's choice.The problem is that the radcomboboxes do not appear to be swapping (i.e., updating on the aspx page) unless the page is reloaded, which I'm assuming happens because reloading the page is in essence forcing a postback.

I don't want to force a postback to fix this issue as I feel like that's a brute force workaround, and I want to understand why the logic isn't working as it should.Here's the actual code below. I used generic names for the radcomboboxes above. 
<telerik:AjaxSetting AjaxControlID="cboKey">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="cboKey" />
                <telerik:AjaxUpdatedControl ControlID="cboKey_X2" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="cboKey_X2">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="cboKey_X2" />
<telerik:AjaxUpdatedControl ControlID="cboKey" />
            </UpdatedControls>
        </telerik:AjaxSetting>


Here's the code from combo box 1 SelectedIndexChanged sub:
If Me.cboKey.Visible = True OrElse Me.cboKey_X2.Visible = True Then
If piX2 <> 0 Then
    Me.cboKey.Visible = False
    Me.cboKey_X2.Visible = True
ElseIf piX2 = 0 Then
    Me.cboKey_X2.Visible = False
    Me.cboKey.Visible = True
End If

Any help understanding why this doesn't work would be greatly appreciated!
Amy
Top achievements
Rank 1
 answered on 24 Nov 2014
1 answer
135 views
I've this code behind:
GridEditCommandColumn editCol = (GridEditCommandColumn)rgPropDocs.MasterTableView.GetColumn("EditCommandColumn");
ResponseDocument checkDoc = null;
checkDoc = svc.GetDoc(new Guid(item.GetDataKeyValue("ID").ToString()), new Guid(PID));
Literal litFileUploaded = (Literal)item.FindControl("litFileUploaded");

if (checkDoc == null)
{
editCol.EditText = "Add";
litFileUploaded.Text = "Not Uploaded";
}
else
{
//we have document for this type
editCol.EditText = "Edit";
litFileUploaded.Text = checkDoc.OriginalFileName;
}

on the grid I get the first row with correct edit text of "edit" but then the 2nd row is also coming to "edit" in place of "add" and third row I get it correct which is "add".  The above code is in item databound event.
Neepa
Top achievements
Rank 1
 answered on 24 Nov 2014
1 answer
238 views
How to bring the Export to Excel icon from right position to left position of the grid?
Kostadin
Telerik team
 answered on 24 Nov 2014
14 answers
509 views

Hello,

I'm using the following to provide checkboxes for row selection in one of my grids:

<telerik:GridClientSelectColumn UniqueName="ClientSelectColumn">  
    <HeaderStyle Width="20px"></HeaderStyle> 
</telerik:GridClientSelectColumn> 

I'd like to be able to filter the contents of the grid based upon whether or not a row is selected.  E.g. display all rows, only those selected, or only those not selected.  I'm figuring it's not as simple as just setting AllowFilteringByColumn="true", but would like to know if it's possible through built-in means or if I have to do it through some custom code.  As simple as this seems, I couldn't find anything about it in the forums.

Currently, when setting AllowFilteringByColumn to true, I get the filter boxes on all of my other columns, but nothing on this one as for filter options.

I'm using Q32008 .NET 3.5 version of the controls.

Any help is greatly appreciated.
Thanks in advance,
Marty
Maria Ilieva
Telerik team
 answered on 24 Nov 2014
11 answers
238 views
Hi,

I am trying to open a radwindow from radgrid edit link template field . This is done from clientclick script I mean as follows
OnClientClick="return windowopen();"  but the thing is , I have 4 records as of now. the radwindow needs to get displayed appropriately beneath each row.
I mean if it is first row , the window should get opened below that. if it is 4th row , or nth row the window should get opened beneath that.


Kindly help.


-Thanks
Gayathri
Konstantin Dikov
Telerik team
 answered on 24 Nov 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?