Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
485 views
I am helping a guy with an asp.net project using rad controls.  It's pretty much a database administration site.  So there are a bunch of RadGrids displaying the data.  The problem is there is horizontal scrolling necessary, and I think that looks terrible.  I would rather the columns get narrower, based on some set of minimum sizes, and word wrap as necessary.  I found I could sort of do this like this:

Form[action="JobPosting.aspx"] colgroup col:nth-child(1)
          {
          
              width: 50px  !important;
          }​
Form[action="JobPosting.aspx"] colgroup col:nth-child(2)
          {
         
              width: 100px  !important;
          }

Here is the full asp code:
<%@ Page Title="" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="JobPosting.aspx.cs" Inherits="ASPNETCMS.JobPosting.JobPosting" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
 
</asp:Content>
 
 
 
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
   
 
  <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
 
            <script type="text/javascript">
            function RowDblClick(sender, eventArgs)
            {
              sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
            }
            </script>
     
        </telerik:RadCodeBlock>
         
         
    <telerik:RadGrid Width="90%" Height="400px" ID="RadGrid1" runat="server"
        AllowAutomaticInserts="True"
       GridLines="None" Skin="Hay" AllowFilteringByColumn="True"
        AllowPaging="True" DataSourceID="LinqDataSource1"
        onselectedindexchanged="RadGrid1_SelectedIndexChanged"
        AutoGenerateColumns="False"
        oninsertcommand="RadGrid1_InsertCommand"
         OnDeleteCommand="RadGrid1_DeleteCommand"
        onitemcommand="RadGrid1_ItemCommand">
          <ClientSettings>
                <Selecting AllowRowSelect="True" />
                <ClientEvents OnRowDblClick="RowDblClick" />
                <Resizing EnableRealTimeResize="true" />
<Scrolling AllowScroll="True" UseStaticHeaders="false"></Scrolling>
            </ClientSettings>
<MasterTableView  CommandItemDisplay="Top"
            DataSourceID="LinqDataSource1" PageSize="25" EditMode="EditForms"   >
             <Columns>
                 <telerik:GridButtonColumn CommandName="Select" Text="Select"
                     UniqueName="column1" ItemStyle-Wrap="true">
                 </telerik:GridButtonColumn>
                 <telerik:GridBoundColumn DataField="jobID" DataType="System.Int32"
                     HeaderText="jobID" SortExpression="jobID" UniqueName="jobID"
                     Visible="False" Resizable="true" ItemStyle-Wrap="true" >
                 </telerik:GridBoundColumn>
                 <telerik:GridBoundColumn DataField="jobTitle" HeaderText="Title"
                     SortExpression="jobTitle" UniqueName="jobTitle"  ItemStyle-Wrap="true">
                 </telerik:GridBoundColumn>
                 <telerik:GridBoundColumn DataField="jobLocation" HeaderText="Location"
                     SortExpression="jobLocation" UniqueName="jobLocation" Visible="False">
                 </telerik:GridBoundColumn>
                 <telerik:GridBoundColumn DataField="jobType" HeaderText="job Type"
                     SortExpression="jobType" UniqueName="jobType">
                 </telerik:GridBoundColumn>
                 <telerik:GridBoundColumn DataField="jobContactEmail" HeaderText="jobContactEmail"
                     SortExpression="jobContactEmail" UniqueName="jobContactEmail"
                     Visible="False">
                 </telerik:GridBoundColumn>
                 <telerik:GridBoundColumn DataField="jobContactAddress"
                     HeaderText="jobContactAddress" SortExpression="jobContactAddress"
                     UniqueName="jobContactAddress" Visible="False">
                 </telerik:GridBoundColumn>
                 <telerik:GridBoundColumn DataField="jobDescription"
                     HeaderText="jobDescription" SortExpression="jobDescription"
                     UniqueName="jobDescription" Visible="False">
                 </telerik:GridBoundColumn>
                 <telerik:GridBoundColumn DataField="jobStatus"
                     HeaderText="job Status" SortExpression="jobStatus" UniqueName="jobStatus">
                 </telerik:GridBoundColumn>
                 <telerik:GridBoundColumn DataField="opening_date" HeaderText="opening date"
                     SortExpression="opening_date" UniqueName="opening_date" Visible="False"
                     DataType="System.DateTime">
                 </telerik:GridBoundColumn>
                 <telerik:GridBoundColumn DataField="closing_date" HeaderText="closing date"
                     SortExpression="closing_date" UniqueName="closing_date"
                     DataType="System.DateTime">
                 </telerik:GridBoundColumn>
                 <telerik:GridBoundColumn DataField="start_date" HeaderText="start_date"
                     SortExpression="start_date" UniqueName="start_date" Visible="False"
                     DataType="System.DateTime">
                 </telerik:GridBoundColumn>
                 <telerik:GridBoundColumn DataField="end_date" HeaderText="end date"
                     SortExpression="end_date" UniqueName="end_date" DataType="System.DateTime">
                 </telerik:GridBoundColumn>
                 <telerik:GridBoundColumn DataField="openUntilFilled"
                     HeaderText="openUntilFilled" SortExpression="openUntilFilled"
                     UniqueName="openUntilFilled" Visible="False">
                 </telerik:GridBoundColumn>
                 <telerik:GridButtonColumn CommandName="Delete" Text="Delete"
                     UniqueName="column"   ButtonType="ImageButton" ImageUrl="~/images/trash_can.png">
                 </telerik:GridButtonColumn>
             </Columns>
             <EditFormSettings EditFormType="WebUserControl" PopUpSettings-ScrollBars="Both"    UserControlName="JobPostingDetail.ascx"   >
                <%--  <PopUpSettings ScrollBars="Auto" Width="800px" Height="600" /> --%><EditColumn UniqueName="EditCommandColumn1"></EditColumn>
 
<PopUpSettings ScrollBars="Both"></PopUpSettings>
             </EditFormSettings>
 
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
 
<ExpandCollapseColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
 
 
    <PagerStyle Mode="Slider" />
    
</MasterTableView>
        <ClientSettings>
            <Selecting AllowRowSelect="True" />
            <Scrolling AllowScroll="True" UseStaticHeaders="True" />
        </ClientSettings>
    </telerik:RadGrid>
 
 
    <asp:LinqDataSource ID="LinqDataSource1" runat="server"
        ContextTypeName="ASPNETCMS.JobPosting.JobsDBDataContext" EnableDelete="True"
        EnableUpdate="True" TableName="tblJobListings" OrderBy="end_date desc">
    </asp:LinqDataSource>
</asp:Content>


 The problem is this seems inconsistent.  Also, the top rows (sort row) and titles don't size accordingly. I have been trying to accomplish this with just modifiying the css and html.  I don't have the actual radcontrols on my computer.  I guess I can try to modify the css for the title and sort row, but in three places it seems redundant, and wrong.

Is there a easy way to do this?

Here is a link of the skewed columns

screenshot

Edit:
There defiantly has to be a pretty simple way to do this.  Using this code:
Form[action="JobPosting.aspx"] #ctl00_ContentPlaceHolder1_RadGrid1_ctl00 colgroup col:nth-child(1)
          {
         background-color:Yellow;
              width: 50px  ;
          }​
Form[action="JobPosting.aspx"] #ctl00_ContentPlaceHolder1_RadGrid1_ctl00  colgroup col:nth-child(2)
          {
         background-color:Blue  !important;
              width: 50px ;
          }
      Form[action="JobPosting.aspx"] #ctl00_ContentPlaceHolder1_RadGrid1_ctl00  colgroup col:nth-child(3)
          {
              background-color:Red;
              width: 10px;
          }
     Form[action="JobPosting.aspx" ] #ctl00_ContentPlaceHolder1_RadGrid1_ctl00  colgroup col:nth-child(4)
          {
               background-color:Orange;
              width: 10px !important;
          }
    Form[action="JobPosting.aspx" ] #ctl00_ContentPlaceHolder1_RadGrid1_ctl00  colgroup col:nth-child(5)
          {  background-color:Purple;
             
              width: 10px !important;
          }
    Form[action="JobPosting.aspx" ] #ctl00_ContentPlaceHolder1_RadGrid1_ctl00  colgroup col:nth-child(6)
          {  background-color:Black;
            
              width: 10px !important;
          }
     Form[action="JobPosting.aspx" ] #ctl00_ContentPlaceHolder1_RadGrid1_ctl00  colgroup col:nth-child(7)
          {  background-color:White;
               
              width: 10px !important;
          }

I get the second screenshot here  screenshot2

The second column isn't being touched.  I don't see why.  


Edit #2:
Ok, So setting the width in the asp control for the grid column's work.  That makes it act like a min-width.  Now the titles and sort row widths are not the same as the regular column widths.  
Pavlina
Telerik team
 answered on 26 Nov 2012
1 answer
61 views
Hi
I have a problem when I open a site, that use radcontrol, in firefox:
  • Errore: ReferenceError: TelerikNamespace is not defined
  • Errore: ReferenceError: RadEditorCommandList is not defined
Thanks
Rumen
Telerik team
 answered on 26 Nov 2012
1 answer
161 views
Hello,

Update:  I just tried other pages that use the ajax manager and none of them now work.

I have a number of dropdowns that on selectedindexchange refresh a grid.  I am using the ajax manager with these controls.  For some reason I am getting this error and I don't believe anythign has changed that I can tell.  I am not certain what it means though.  Anyone have any idea what causes it or how to fix it?  

I don't think it has anything to do with the code behind as this all worked and when i select an item in the dropdown the selectedindexchanged event never gets hit.  It is something happening in between. 

I thought I could attach a screenshot but doesn't look as thought I can.  The error is as follows:  

Microsoft JScript runtime error:  Unable to get value of the property 'id':  object is null or undefined.  

If i click break the code that is erroring is as follows:
if(Array.contains(h,e.get_postBackElement().id)){this._isRequestInProgress=true;

Thanks.

Here is the markup of one of the dropdowns
<div class="row-fluid">
        <div class="span8">
            <div class="category-select">
                <div class="control-group">
                    <label for="ddlStore" class="control-label">Store: </label>
                    <div class="controls">
                        <asp:DropDownList ID="ddlStore" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlStore_SelectedIndexChanged">
                        </asp:DropDownList>
                    </div>
                </div>
            </div>
        </div>
        <div class="span2">
        </div>
    </div>

Markup of the ajax manager
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
       <AjaxSettings>
           <telerik:AjaxSetting AjaxControlID="ddlStore">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="grdPriceTags" LoadingPanelID="rajaxLoading" />
               </UpdatedControls>
           </telerik:AjaxSetting>
           <telerik:AjaxSetting AjaxControlID="ddlItemType">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="grdPriceTags" LoadingPanelID="rajaxLoading" />
               </UpdatedControls>
           </telerik:AjaxSetting>
           <telerik:AjaxSetting AjaxControlID="ddlItemStatus">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="grdPriceTags" LoadingPanelID="rajaxLoading" />
               </UpdatedControls>
           </telerik:AjaxSetting>
           <telerik:AjaxSetting AjaxControlID="ddlVendor">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="grdPriceTags" LoadingPanelID="rajaxLoading" />
               </UpdatedControls>
           </telerik:AjaxSetting>
           <telerik:AjaxSetting AjaxControlID="ddlMinorCode">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="grdPriceTags" LoadingPanelID="rajaxLoading" />
               </UpdatedControls>
           </telerik:AjaxSetting>
           <telerik:AjaxSetting AjaxControlID="ddlPriceTagType">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="grdPriceTags" LoadingPanelID="rajaxLoading" />
               </UpdatedControls>
           </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="txtSKU">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="grdPriceTags" LoadingPanelID="rajaxLoading" />
               </UpdatedControls>
           </telerik:AjaxSetting>
       </AjaxSettings>
 
 
               </telerik:RadAjaxManager>

Code Behind:
protected void ddlStore_SelectedIndexChanged(object sender, EventArgs e)
        {
            FillTagGrid();
        }
 
protected void FillTagGrid()
        {
            //check for valid params
 
            Database.sp_PriceTagList_Select ds = new sp_PriceTagList_Select();
            Database.sp_PriceTagList_SelectTableAdapters.PriceTagList_SelectTableAdapter ta = new Database.sp_PriceTagList_SelectTableAdapters.PriceTagList_SelectTableAdapter();
            ta.Fill(ds.PriceTagList_Select,
                this.ddlItemType.SelectedIndex,
                this.ddlItemStatus.SelectedIndex,
                this.ddlStore.SelectedValue,
                this.ddlVendor.SelectedValue,
                this.ddlMinorCode.SelectedValue,
                (String.IsNullOrEmpty(txtSKU.Text) ? null : txtSKU.Text));
 
            this.grdPriceTags.DataSource = ds.PriceTagList_Select;
            this.grdPriceTags.DataBind();
 
            //
            InitGrid();
 
            //update footer with tag count
            string footer = "Price Tags: {0}";
            if (grdPriceTags.FooterRow != null && ds.PriceTagList_Select.Rows != null)
                this.grdPriceTags.FooterRow.Cells[1].Text = String.Format(footer, ds.PriceTagList_Select.Rows.Count.ToString());
        }

Pavlina
Telerik team
 answered on 26 Nov 2012
6 answers
277 views
If i have a radlistbox that is ajaxified and EnableDragAndDrop is true then when i click around somewhat fast I get [SCRIPT28: Out of stack space] error in ie developer. in Google chrome I get [Uncaught RangeError: Maximum call stack size exceeded]. Sometimes it says there is a long running script. There is nothing else on the page and the page_load event is the only code-behind. After it happens once it starts happening more frequently.

  • Telerik Q3 2012  - (2012.3.1016.35)
  • C# - asp.net 3.5
  • windows 7, 8GB RAM
  • ie9 & google chrome
  • IIS Worker Process Memory is at about 100K in task manager, CPU at 0%


<telerik:RadAjaxManager ID="RadAM1" runat="server">
     <AjaxSettings>
          <telerik:AjaxSetting AjaxControlID="btn">
             <UpdatedControls>
                 <telerik:AjaxUpdatedControl ControlID="radSelected"  />
             </UpdatedControls>
         </telerik:AjaxSetting>
     </AjaxSettings>
 </telerik:RadAjaxManager>
 
 <telerik:RadListBox ID="radSelected" runat="server" Width="100%" Height="400px" SelectionMode="Single" EnableDragAndDrop="true" AutoPostBack="true">
 </telerik:RadListBox>
 <asp:Button ID="btn" runat="server" Text="refresh" />

protected void Page_Load(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
    {
        List<string> strs = new List<string>();
        for (int i = 0; i < 500; i++)
            ints.Add("This is just some text to fill the listbox to show that it will get [SCRIPT28: Out of stack space] when you click around fast for about 20 seconds or less. The listbox freezes and then i get the script error when looking in ie development tool. " + i);
        radSelected.DataSource = ints;
        radSelected.DataBind();
    }
}




Any ideas?

Mitchell
Top achievements
Rank 1
 answered on 26 Nov 2012
7 answers
1.0K+ views
Hi,

I have a CardView radgrid that shows accounts.

        <telerik:RadGrid ID="RadGridAccounts" DataSourceID="SqlDataSourceAccounts" runat="server" 
            OnItemDataBound="RadGridAccounts_OnItemDataBound" AllowPaging="True" PageSize="10" ShowHeader="false">  
           <PagerStyle Mode="NextPrevAndNumeric" /> 
           <MasterTableView><ItemTemplate>  
 
        <h4>Account # <%# DataBinder.Eval(Container.DataItem, "AccountNumber") %> </h4>     
 
        <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>   
        <br /> 
          
        <asp:PlaceHolder ID="PlaceHolder2" runat="server"></asp:PlaceHolder> 
        <br /> 
 
        <asp:PlaceHolder ID="PlaceHolder3" runat="server"></asp:PlaceHolder> 
                  
    </ItemTemplate> 
</MasterTableView> 
   </telerik:RadGrid> 
 

 

For each account I show different account details in three radgrids that I create dynamically.

                RadGrid1 = new RadGrid();     
                RadGrid1.Skin = "Office2007";     
                RadGrid1.Width = Unit.Percentage(100);     
                RadGrid1.AutoGenerateColumns = false;     
    
                boundColumn = new GridBoundColumn();     
                boundColumn.DataField = "Asset";     
                boundColumn.HeaderText = "Asset";     
                RadGrid1.MasterTableView.Columns.Add(boundColumn);     
    
                boundColumn = new GridBoundColumn();     
                boundColumn.DataField = "Value";     
                boundColumn.HeaderText = "Value";     
                boundColumn.DataFormatString = "{0:C}";     
                RadGrid1.MasterTableView.Columns.Add(boundColumn);     
    
                RadGrid1.DataSource = dt;     
                RadGrid1.DataBind();     
    
                PlaceHolder1.Controls.Add(RadGrid1);     
 

What I need to do is dynamically add a checkbox to each row in the radgrid. When I try this:

                GridCheckBoxColumn checkboxColumn = new GridCheckBoxColumn();  
                checkboxColumn.DataField = "Problem";  
                checkboxColumn.HeaderText = "Problem?";  
                RadGrid1.MasterTableView.Columns.Add(checkboxColumn);  
 

then the checkboxes are disabled. I guess I need to put the grid in edit mode? How would I do that? I don't want the users to edit any columns besides checking the checkboxes.

Another question is - after a user checks some checkboxes and clicks on "Save", how do I refer to the checkboxes inside the grids inside the accounts grid to save the changes to the database?

Thanks,
Julia

Pavlina
Telerik team
 answered on 26 Nov 2012
0 answers
75 views
Hi,
I am using radtreeview, i need to use ajax for binding the values based on the radtreeviewcontext menu. How i Can restrict ajax for the specific <telerik:RadTreeViewContextMenu> (for the Exporting pdf). 







Thanks

Dhamodharan
Top achievements
Rank 1
 asked on 26 Nov 2012
1 answer
115 views
I'm using RadPanelBar on a master page as a main navigation control. On some content pages I make calls to Response.Redirect() method and I want the PanelBar SelectedItem to be changed accordingly. How can I achieve this? I have to mention that I use PersistStateInCookie="true" for state persistence.
Any help?
Boyan Dimitrov
Telerik team
 answered on 26 Nov 2012
1 answer
86 views
Hello,
I an new to telerik controls and coding.
I have a task where I need to use a Radalert, that uses javacript funtion to open a new page,  from a resource file. Is it possible?? Can i use a Radlaert from a resource file? If yes please guide how can i do this?  Appreciate your answers.

Thanks
Rumen
Telerik team
 answered on 26 Nov 2012
1 answer
464 views
Hello everybody,

We have a project that uses several RadGrids in many ASP sites. We created the RadGrid in an seperate UserControl and this works very well. Now I have an issue from a customer that concerns the filtering.

Init / Problem:
We enable the filtering by default in our colums and that's works good too. So the user can enter a value, then hit the TAB or ENTER key and the RadGrid filters with it's values. Now in some cases the user would like to enter all of the filter values first and start the filtering by pressing the ENTER key.

I've searched a lot in your forums and found that some users had a similar problem. What I tested now is to add the folowing code (in the ItemDataBound event from the RadGrid) to prevent the execution of the filter by pressing the TAB key in the filter textbox or loosing it's focus.

filterBox.Attributes.Add("OnChange", "javascript:return false;")

Now this works also very well and the filtering start by pressing the ENTER button, but I figured out that this not solve my problem. Because when I enter a filter value in 2 or more colums only the last entered value will be filtered and sometimes the filter is cleared and the RadGrid is not filtered.

You can see this behavior in this demo project provided from "Tsventina" (Link: Filtering on ENTER key). Please notice that we use the last release of the Telerik Controls but the behavior is the same.

You can see the problem by testing as follows:
1. Enter value in column "ContactName" and press ENTER -> Result: RadGrid is filtered OK
2. Enter value in column "ContactName" and press TAB and then ENTER -> Result: Value in column is cleared, RadGrid is not filtered
3. Enter value in column "ContactName" go to for e.g. column "Address" and enter a second filter value and press ENTER -> Result: Value in column "ContactName" is cleared, value in column "Address" is filtered.
4. Enter value in column "ContactName" go to for e.g. column "Address" and enter a second filter value and press TAB (you're possibly in column "City") and then press ENTER -> Result: All filter values are gone, RadGrid is not filtered

I hope you're understand what I'd like to say and it would be very nice if someone of you have a workarround for me.

Thanks in advance.

Best greetings from Switzerland
Reto

PS: Maybe...sorry for my bad english :)
Kostadin
Telerik team
 answered on 26 Nov 2012
1 answer
104 views
The editable image height and width are getting '0' in firefox and other browsers.

var imgWidth = editor.getEditableImage().get_width();
 var imgHeight = editor.getEditableImage().get_height();     

image original height and width are getting only in internet explorer.how can i get original width and height using all browsers.

aspx:

 <telerik:RadImageEditor ID="rieControl" runat="server" OnImageLoading="rieControl_ImageLoading"
                        OnClientLoad="OnClientLoad" OnClientToolsDialogClosed="dialogclose" ExternalDialogsPath="ImageEditorDialogs"
                        ImageUrl="" OnClientCommandExecuted="OnClientCommandExecuted" ImageManager-EnableContentProvider="true"
                        Width="1030px" Height="700px" ToolsFile="~/XmlFiles/PbUserContentImageEditor_ToolBasic.xml">
                    </telerik:RadImageEditor> var editor = $find("<%= rieControl.ClientID %>");
script:
 function OnClientLoad(sender, args) {
            if (sender._imageKey != undefined) {
  var imgWidth = editor.getEditableImage().get_width();
                var imgHeight = editor.getEditableImage().get_height();                       
                if (!isNaN(Number(imgWidth)) && Number(imgWidth) != 0 && !isNaN(Number(imgHeight)) && Number(imgHeight) != 0) {
                    if (imgWidth > 1000 || imgHeight  > 700) {
                        var widthPercentage = (1000 * 100) / Number(imgWidth);
                        var heightPercentage = (700 * 100) / Number(imgHeight);
                        widthPercentage = Math.floor(widthPercentage);
                        heightPercentage = Math.floor(heightPercentage);
                        if (heightPercentage > widthPercentage) {
                            sender._zoomImage(widthPercentage);
                            objhdnReset.value = widthPercentage;
                        }
                        else {
                            sender._zoomImage(heightPercentage);
                       }
                    }
                }
            }
Vessy
Telerik team
 answered on 26 Nov 2012
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?