Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
211 views
I have a statically declared Grid as follows:
        <telerik:RadPageView ID="PageView4" runat="server" Width="100%" > 
        <table width="100%" cellpadding="5">  
            <tr><td>  
                <asp:Button ID="btnExport" runat="server" Text="Export Results to Excel" OnClick="btnExport_Click" /> 
            </td></tr>  
            <tr> 
            <td>      
            <telerik:RadGrid   
                ID="radgridResources"   
                runat="server"   
                AllowPaging="True"   
                Width="100%" 
                enableEmbeddedSkins="false" 
                Skin="FaCTS" 
                pagesize="15" 
                 AllowSorting="true"    
                OnPageIndexChanged="radgridResources_PageIndexChanged"   
                OnItemCommand="radgridResources_ItemCommand" 
                OnSortCommand="radgridResources_SortCommand" 
                ClientSettings-AllowKeyboardNavigation="true" 
                EnableNoRecordsTemplate="true" 
                 ItemStyle-HorizontalAlign="Center" 
                 AlternatingItemStyle-HorizontalAlign="Center" 
                 HeaderStyle-HorizontalAlign="Center">  
                <PagerStyle Mode="NextPrevAndNumeric" /> 
                <MasterTableView   
                    AutoGenerateColumns="False"   
                    DataKeyNames="ID"   
                    Width="100%" 
                    CommandItemDisplay="None"   
                    PageSize="15">  
                    <Columns> 
                    </Columns> 
                    <EditFormSettings> 
                        <PopUpSettings ScrollBars="None" /> 
                    </EditFormSettings> 
                    <NoRecordsTemplate> 
                        <div align="center" style="color:darkorange">---------- No Records to Display -----------</div>   
                    </NoRecordsTemplate> 
                </MasterTableView> 
                <ClientSettings> 
                </ClientSettings> 
            </telerik:RadGrid></td></tr></table></telerik:RadPageView> 
 

I create columns and bind data to this grid dynamically on the results of a search.

    protected void LoadResources(bool resetPage)  
    {  
        //basic or advanced?  
        if (Session["ResourceSearchType"] == "basic")  
        {  
            _resources = ResourceService.GetSimpleSearchResults(txtName.Text, Int32.Parse(ddlServiceCategory1.SelectedValue), Int32.Parse(ddlServiceCategory2.SelectedValue), Int32.Parse(ddlServiceCategory3.SelectedValue), Int32.Parse(ddlCityProx.SelectedValue), txtZipCode.Text, txtAddress.Text, Int32.Parse(ddlCityExact.SelectedValue), txtZipCodeExact.Text,  Int32.Parse(ddlLanguage.SelectedValue), Int32.Parse(ddlCity1.SelectedValue), Int32.Parse(ddlCity2.SelectedValue), Int32.Parse(ddlCity3.SelectedValue), txtDescription.Text);  
        }  
        else if ((Session["ResourceSearchType"] == "advanced") && (!(txtSqlWhere.Text == string.Empty)))  
        {  
            //load the advanced search resources  
            _resources = ResourceService.GetAdvancedSearchResults(txtSqlWhere.Text);  
        }  
 
 
        //see if we're using the selected columns  
        if (((rdoBasicUseSelectedColumns.Checked == true) && (Session["ResourceSearchType"] == "basic")) ||  
            ((rdoAdvancedUseSelectedColumns.Checked == true) && (Session["ResourceSearchType"] == "advanced")))  
        {  
           ...  
        }  
        else  
        {   
              
            //Use the default columns  
              
            ///todo:  
            ///load the default columns from the database for a search  
              
            radgridResources.MasterTableView.Columns.Clear();  
              
            GridButtonColumn _buttonColumn;  
            GridBoundColumn _boundColumn;  
            GridHyperLinkColumn _hyperLinkColumn;  
 
            _buttonColumn = new GridButtonColumn();  
            radgridResources.MasterTableView.Columns.Add(_buttonColumn);  
            _buttonColumn.ButtonType = Telerik.Web.UI.GridButtonColumnType.LinkButton;  
            _buttonColumn.DataTextField = "Name";             
            _buttonColumn.HeaderText = "Name";  
            _buttonColumn.CommandName = "Edit";  
            _buttonColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Center;  
            _buttonColumn.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;  
            _buttonColumn.SortExpression = "Name";  
            _buttonColumn.HeaderStyle.Width = 150;  
 
            _boundColumn = new GridBoundColumn();  
            radgridResources.MasterTableView.Columns.Add(_boundColumn);  
            _boundColumn.DataField = "Phone1Description";  
            _boundColumn.HeaderText = "Phone 1";  
            _buttonColumn.SortExpression = "Phone1Description";  
            _boundColumn.HeaderStyle.Width = 100;  
 
            _boundColumn = new GridBoundColumn();  
            radgridResources.MasterTableView.Columns.Add(_boundColumn);  
            _boundColumn.DataField = "Phone2Description";  
            _boundColumn.HeaderText = "Phone 2";  
            _buttonColumn.SortExpression = "Phone2Description";  
            _boundColumn.HeaderStyle.Width = 100;  
 
            _boundColumn = new GridBoundColumn();  
            radgridResources.MasterTableView.Columns.Add(_boundColumn);  
            _boundColumn.DataField = "Phone1Description";  
            _boundColumn.HeaderText = "Phone 3";  
            _buttonColumn.SortExpression = "Phone3Description";  
            _boundColumn.HeaderStyle.Width = 100;  
 
            _boundColumn = new GridBoundColumn();  
            radgridResources.MasterTableView.Columns.Add(_boundColumn);  
            _boundColumn.DataField = "DescriptionSummary";  
            _boundColumn.HeaderText = "DescriptionSummary";  
 
            _hyperLinkColumn = new GridHyperLinkColumn();  
            radgridResources.MasterTableView.Columns.Add(_hyperLinkColumn);  
            _hyperLinkColumn.DataTextField = "WebSiteURL";  
            string[] fields = { "WebSiteURL" };  
            _hyperLinkColumn.DataNavigateUrlFields = fields;  
            _hyperLinkColumn.DataNavigateUrlFormatString = "{0}";  
            _hyperLinkColumn.HeaderStyle.Width = 150;  
            _hyperLinkColumn.HeaderText = "Web Site";  
            _hyperLinkColumn.Target = "_blank";  
             
            _boundColumn = new GridBoundColumn();  
            radgridResources.MasterTableView.Columns.Add(_boundColumn);  
            _boundColumn.DataField = "MinimumDistance";  
            _boundColumn.HeaderText = "Min Distance";  
            _boundColumn.SortExpression = "MinimumDistance";  
            _boundColumn.HeaderStyle.Width = 80;  
 
            if (((UserProfile)Session["_userProfile"]).IsAuthorized("Resource - Delete"))  
            {  
                _buttonColumn = new GridButtonColumn();  
                radgridResources.MasterTableView.Columns.Add(_buttonColumn);  
                _buttonColumn.ButtonType = GridButtonColumnType.ImageButton;  
                _buttonColumn.ConfirmDialogType = GridConfirmDialogType.Classic;  
                _buttonColumn.ConfirmText = "Delete this resource?";  
                _buttonColumn.HeaderText = "Delete";  
                _buttonColumn.HeaderStyle.Width = 60;  
                _buttonColumn.CommandName = "Delete";  
                _buttonColumn.ImageUrl = "./images/delete.gif";  
            }  
        }  
        radgridResources.MasterTableView.TableLayout = GridTableLayout.Fixed;  
 
        radgridResources.DataSource = _resources;  
        if (resetPage == true)  
        {  
            radgridResources.CurrentPageIndex = 0;  
        }  
        radgridResources.DataBind();  
        radgridResources.Focus();  
    }  
 

When the results are bound to the grid I use the down arrow key to navigate to the record of interest and press enter.  Normally on a grid where the columns are declared in the aspx file the

radgridResources_ItemCommand

event handler is fired once and I navigate to a page based on the Id of the row.

For some reason the Sort event is getting fired also when the enter key is pressed,  the command argument the first time through the ItemCommand event is "Edit" as is expected and the next time through ItemCommand it is "Sort" after whihc the ItemSorted event is fired also.

I tried setting allowsorting to false and taking out the sorting command handler, and the behaviour gets a little wierder in that the Export to Excel button that is outside the grid is fired in addition to the ItemCommand of the Grid.  Also in this scenario the grid does not recieve focus as specified, so I have to manually click the grid with the mouse before I can navigate with the keyoard.  Could you provide some insight as to the problem?  Thanks
Jonathan




Nikolay Rusev
Telerik team
 answered on 23 Feb 2009
1 answer
114 views
Hi
I am in the grid Command event and I can not cast to GridBoundControl:

Protected Sub RadGrid1_UpdateCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs)  
    Dim _flg As GridBoundColumn = CType(e.Item.FindControl("flgColumn"), GridBoundColumn)  
End Sub  
 
Says: Value of type 'System.Web.UI.Control' cannot be converted to 'Telerik.Web.UI.GridBoundColumn'.  I am able to find templated controls this way but how do I find the Bound controls?
Princy
Top achievements
Rank 2
 answered on 23 Feb 2009
4 answers
124 views
How can I do the selection of a row in child grid, using javascript??
Princy
Top achievements
Rank 2
 answered on 23 Feb 2009
2 answers
99 views

Hi,

I am having a problem with the conversion of partial dates in the RadDatePicker when the culture is set to Australia.  The issue is that if a user enters a date of 6/2008 the control converts it to 6/2/2008 instead of 1/6/2008.

While this makes sense for a US date format of MM/dd/yyyy it is incorrect for an AU date format of dd/MM/yyyy.

Is there any way I can make the date picker convert the date correctly?

thanks

Gavin.

Gavin
Top achievements
Rank 1
 answered on 23 Feb 2009
2 answers
107 views
Hi,

We are having problems styling links in the design view of the editor iframe in Firefox (version 3.0.4).

Safari and Internet Explorer (6 and 7) are recognising our custom link styles, but Firefox is not. We've tried applying the styles inline in the a tag, embedding them in the iframe head element, and linking to an external stylesheet. We have also ensured that our Firefox preferences are set to allow pages to choose their own colours, and that "use system colours" is unchecked.

The problem can be easily replicated in the editor on one of your demo pages, here for example.

Add a link anywhere in the content area with a simple inline style for the color property, eg:

<href="www.google.com" style="color: #FF0033;">test link colours</a> 

In design view in Firefox, the link is still being displayed in the default blue while in Safari and Internet Explorer, the link text is red, as expected. However, strangely enough, in the editor preview view in Firefox, the link style is being applied.

Thanks for your time,
Mathew.
Mathew
Top achievements
Rank 1
 answered on 23 Feb 2009
2 answers
78 views
I have a beginner Telerik question, or rather a request for advice. I'm still getting acquainted with the toolkit, so I'm not really sure which of the two components would be better for what I am trying to do.

I want to output a calendar in typical calendar view where each date has exactly one event (exercise of the day). When you click on the event, a window pops up (not a javascript popup like the ones that get blocked, but a div) with information about the event.

Can I do this using the calendar control? I couldn't see how to set text aside from the day number text. Would a scheduler control be better? Wouldn't a scheduler control be overkill? Is there a control for doing the popup that I want?

Any advice anyone can give would be great.

I've really enjoyed the Telerik controls and documentation. You guys do an amazing job. You make programming fun.
David
Top achievements
Rank 1
 answered on 23 Feb 2009
1 answer
76 views
I have the following setup:

Root
- MasterPages (Folder)
-- MasterPage.master
- Contacts (Folder)
-- EditContactDetails.aspx

And my IIS is setup as http://localhost/ProjectName/

In my master page I have a dashboard that has various controls (RadCalendar, RadPanels, RadMultiPage).  I have added the script manager and everything renders fine.  However, I cannot change dates in the calendar such as going from February to March, etc.  I have added the CSS Skin that I want for the calendar to my project and the mouseover effects run fine but if I do not add the css, the skin does not get recognized.

I have a feeling I am running into issues with file locations and the system not able to find either the .js or .css that are created by the controls.  Is there a way to override this or is there another folder structure I need to switch to?
Vic
Top achievements
Rank 1
 answered on 22 Feb 2009
5 answers
162 views

Hi,

I tried to apply RTL locales on RadMenu control with Forest Skin, but unfortunately the control appearance is damaged!! And I tried to fix the skin with RTL support but I’m not expert in CSS. for that I’m asking for a help…

By the way, I’m wondering how come Telerik team create a skin doesn’t support RTL?

Thanks a lot in advance

jalal
Top achievements
Rank 1
 answered on 22 Feb 2009
6 answers
331 views
Hi,

Radtree has context menus (new, edit, delete). For this switch statement is written .cs page. For delete option clicked in context menu i have to confirm to delete r not. If yes then written to switch statement in .cs page. Please reply me as soon as possible.

For this i have used script in this way .. but not working.

<

script type="text/javascript">

 

function

confirmfun()

 

{

if

(confirm('r u sure u want to delete'))

 

return

true;

 

else

return false;

 

}

</

script>

 



in aspx.cs page :

 

public

void menuclick(object sender, Telerik.Web.UI.RadTreeViewContextMenuEventArgs e)

 

{

 

switch (e.MenuItem.Text)

 

{

 

case "delete":

 

treecontextmenu.Attributes.Add(

"onclick", "return confirmfun()");

 

 

 

if (e.Node.Nodes.Count.Equals(0))

 

{

e.Node.Remove();

}

 

else

 

Response.Write(

"<script> alert('deletion is not possible')</script>");

 

 

break;

 

}

}

 

Darren Fuller
Top achievements
Rank 2
 answered on 21 Feb 2009
1 answer
190 views
Hello,

I am trying to specify the Skin to use in my web.config file but it doesn't seem to work. 

 

<telerik:RadComboBox ID="radSkinTest" runat="server"></telerik:RadComboBox>

<appSettings>
<add key="Telerik.Web.UI.Skin" value="Vista"/>
</appSettings>

Any help would be appreciated.
Feizal

 

 

 

 

 

 

 

 

 

Dimo
Telerik team
 answered on 21 Feb 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?