Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
386 views
I hope I'm not too vague here and I'll be happy to post a project or just explain a bit better if required.

I have a simple grid with two columns. I am databinding the grid with NeedsDataSource, dynamically creating a DataTable in code-behind from a business object. I am trying to completely avoid using ObjectDataSources.  In short:

Column1 = Entity.EmailAddress (example: abc@def.com)
Column2 = Entity.EmailAddressType.Description

EmailAddressType is an object of EmailAddressType with properties ID and Description. (example: hm=Home)

The grid simply allows someone to enter a number of email addresses, and what they're for: Home, Work, School, etc., with the type limited to a provided selection.

The ItemTemplate for column2 renders "Home". The EditItemTemplate presents a RadComboBox, also generated at runtime, with all EmailAddressTypes loaded with Value=type.ID and Text=type.Description.

At runtime, I can elect to Insert or Update, and the ComboBox renders the list. Everything looks good until changes are submitted.

The problem is that when I change the data and click Update, the RadGrid ItemUpdated event is fired, but only the first column with the address is available in the event e.Item.  I thought the selected value from the second column EditItemTemplate would be available there too.

I don't think I'm properly defining the RadComboBox within the EditItemTemplate.  Do I need to check the combobox itself to get the value?  (Not sure it's available when ItemUpdated fires)  How do I ensure that the value of the combobox is associated with the cells in the row being changed so that when postback events are fired the selected value comes back with all other data?  (I haven't tried but I suspect I'm going to have the same problem with other controls, so what I learn here will be very helpful for subsequent work.

As to why I want to avoid ObjectDataSource: It's just too flaky, not powerful enough, always leaving something to be desired somewhere between markup and codebehind. Read notes by Nikhil Khotari, Manuel Abadia, and many others. So I'm trying to get some practice doing everything programmatically, and unfortunately sacrificing some of the designer benefits of binding to a datasource at design time.

Thanks!
TonyG
Top achievements
Rank 1
 answered on 02 Sep 2010
2 answers
208 views
I have a RadGrid where i need to change the css style for a row for all selected items when a certain button is clicked (client-side)

The style for the row is originally set in ItemDataBound:

If

 

 

dataItem("Printed").Text = "False" Then

 

e.Item.CssClass =

 

"rgRow unViewedEval"

 

 

 

End If

 


I want to change the cssclass for the row to "rgRow viewedEval" once a button is clicked
The button triggers the javascript below:

function

 

 

GetSelectedItems(theGrid) {

 

 

 

var grid = $find(theGrid);

 

 

 

if (grid) {

 

 

 

var MasterTable = grid.get_masterTableView();

 

 

 

var selectedRows = MasterTable.get_selectedItems();

 

 

 

for (var i = 0; i < selectedRows.length; i++) {

 

 

 

var row = selectedRows[i];

 

row.className =

 

'rgRow viewedEval';

 

}

}

}

How do I access the style for each row? Obviously "row.className = " is not it.

Richard Boarman
Top achievements
Rank 1
 answered on 02 Sep 2010
3 answers
136 views
Greetings,

I am getting "Error: Object expected" when creating a new RadTab. Any ideas what could be causing this? It makes no sense to me, and it only happens when the script resides in a RadWindow.

function openingNewWindow(oWnd, title) {
    if (oWnd) {
        tabStrip.trackChanges();
        //create a new tab
        var tab = new Telerik.Web.UI.RadTab();
        //set the text of the tab
        tab.set_text(title);
        oWnd.correspondingTab = tab;
        //add the tab to the tabstrip
        tabStrip.get_tabs().add(tab);
        tabStrip.repaint();
        tab.correspondingWnd = oWnd;
        tab.set_imageUrl("../CSS/titlegraphic.gif");
        tabStrip.commitChanges();
        //Select this tab
        tab.select();
    }
}


Regards,
Tom
Yana
Telerik team
 answered on 02 Sep 2010
1 answer
242 views

Hi
I just downloaded trial version and was trying to bind data to the Grid and got this error.

Error 2 Unable to copy file "..\..\..\..\..\..\..\Program Files\Telerik\RadControls for ASP.NET AJAX Q2 2010\Bin20\Telerik.Web.UI.dll" to "bin\Telerik.Web.UI.dll". The process cannot access the file 'bin\Telerik.Web.UI.dll' because it is being used by another process. 

Thank you
Neetah
Maria Ilieva
Telerik team
 answered on 02 Sep 2010
1 answer
421 views

 

I have Radgrid in which I am showing the data.

whenever there is a postback I am showing a loding panel with the help of
RadAjaxManager and RadAjaxLoadingPanel.

There is a facility to filter the Grid. After applying the filters, if there are no records for the filter criteria, I am making the Grid visible false. but after that if I apply new filter and make a postback, it throws the following error. As long as there are records in Grid and it is visible, I can apply filters and it works fine. But if there are no records for the filter criteria and I hide the Grid, it does not work for the next time even if I make the Grid Visble true. It throws the following exception. Please suggest.

Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation. 


My code is as below.

protected void Page_Load(object sender, EventArgs e)
        {
              
            pnlError.Visible = false;
            setControlsVisibility(true);
              
        }
  
 protected void btnFilterResults_Click1(object sender, ImageClickEventArgs e)
        {
            FilterGrid();
        }
  
void FilterGrid()
        {
            IsTopCommandCreated = false;
  
            // Sites = All, ToDate & FromDate are selected
            if (RadComboBoxSites.SelectedIndex == 0 && ToDatePicker.SelectedDate != null && FromDatePicker.SelectedDate != null)
            {
                RadGrid1.MasterTableView.FilterExpression = "(([DateDue] >= \'" + FromDatePicker.SelectedDate.ToString() + "\')"
                                                            + " AND " + "([DateDue] <= \'" + ToDatePicker.SelectedDate.ToString() + "\'))";
            }
            // Sites = All, ToDate = selected, FromDate = NULL
            else if (RadComboBoxSites.SelectedIndex == 0 && ToDatePicker.SelectedDate != null && FromDatePicker.SelectedDate == null)
            {
                RadGrid1.MasterTableView.FilterExpression = "([DateDue] <= \'" + ToDatePicker.SelectedDate.ToString() + "\')";
            }
            // Sites = All, ToDate = NULL, FromDate = selected
            else if (RadComboBoxSites.SelectedIndex == 0 && ToDatePicker.SelectedDate == null && FromDatePicker.SelectedDate != null)
            {
                RadGrid1.MasterTableView.FilterExpression = "([DateDue] >= \'" + FromDatePicker.SelectedDate.ToString() + "\')";
            }
            // Sites = Specific Site, ToDate & FromDate are selected
            else if (RadComboBoxSites.SelectedIndex != 0 && ToDatePicker.SelectedDate != null && FromDatePicker.SelectedDate != null)
            {
                RadGrid1.MasterTableView.FilterExpression = "(([SiteName] LIKE \'%" + RadComboBoxSites.SelectedItem.Text + "%\') "
                                                            + " AND " + "([DateDue] >= \'" + FromDatePicker.SelectedDate.ToString() + "\')"
                                                            + " AND " + "([DateDue] <= \'" + ToDatePicker.SelectedDate.ToString() + "\'))";
            }
            // Sites = Specific Site, ToDate = selected, FromDate = NULL
            else if (RadComboBoxSites.SelectedIndex != 0 && ToDatePicker.SelectedDate != null && FromDatePicker.SelectedDate == null)
            {
                RadGrid1.MasterTableView.FilterExpression = "(([SiteName] LIKE \'%" + RadComboBoxSites.SelectedItem.Text + "%\') "
                                                            + " AND " + "([DateDue] <= \'" + ToDatePicker.SelectedDate.ToString() + "\'))";
            }
            // Sites = Specific Site, ToDate = NULL, FromDate = selected
            else if (RadComboBoxSites.SelectedIndex != 0 && ToDatePicker.SelectedDate == null && FromDatePicker.SelectedDate != null)
            {
                RadGrid1.MasterTableView.FilterExpression = "(([SiteName] LIKE \'%" + RadComboBoxSites.SelectedItem.Text + "%\') "
                                                            + " AND " + "([DateDue] >= \'" + FromDatePicker.SelectedDate.ToString() + "\'))";
            }
            // Sites = Specific Site, ToDate & FromDate are NULL
            else if (RadComboBoxSites.SelectedIndex != 0 && ToDatePicker.SelectedDate == null && FromDatePicker.SelectedDate == null)
            {
                RadGrid1.MasterTableView.FilterExpression = "([SiteName] LIKE \'%" + RadComboBoxSites.SelectedItem.Text + "%\')";
            }
            // Otherwise display open invoices for all regional sites.
            else
            {
                RadGrid1.MasterTableView.FilterExpression = "";
            }
  
            GridColumn columnSite = RadGrid1.MasterTableView.GetColumnSafe("SiteName");
            GridColumn columnDateDue = RadGrid1.MasterTableView.GetColumnSafe("DateDue");
  
            // Sites = Specific Site
            if (RadComboBoxSites.SelectedIndex != 0)
            {
                columnSite.CurrentFilterFunction = GridKnownFunction.Contains;
                columnSite.CurrentFilterValue = RadComboBoxSites.SelectedItem.Text;
            }
  
            // ToDate & FromDate are selected
            if (ToDatePicker.SelectedDate != null && FromDatePicker.SelectedDate != null)
            {
                columnDateDue.CurrentFilterFunction = GridKnownFunction.Between;
                columnDateDue.CurrentFilterValue = "(([DateDue] >= \'" + FromDatePicker.SelectedDate.ToString() + "\')"
                                                    + " AND " + "([DateDue] <= \'" + ToDatePicker.SelectedDate.ToString() + "\'))";
            }
            // ToDate = selected, FromDate = NULL
            else if (ToDatePicker.SelectedDate != null && FromDatePicker.SelectedDate == null)
            {
                columnDateDue.CurrentFilterFunction = GridKnownFunction.LessThanOrEqualTo;
                columnDateDue.CurrentFilterValue = "([DateDue] <= \'" + ToDatePicker.SelectedDate.ToString() + "\')";
            }
            // ToDate = NULL, FromDate = selected
            else if (ToDatePicker.SelectedDate == null && FromDatePicker.SelectedDate != null)
            {
                columnDateDue.CurrentFilterFunction = GridKnownFunction.GreaterThanOrEqualTo;
                columnDateDue.CurrentFilterValue = "([DateDue] >= \'" + FromDatePicker.SelectedDate.ToString() + "\')";
            }
  
            RadGrid1.DataSourceID = "InvoiceDataSource";
            RadGrid1.MasterTableView.Rebind();  
        }
  
        /// <summary>
        /// Set the visibility of the main datatable, the filtering and the forwardtoColleague sections
        /// </summary>
        /// <param name="visibility"></param>
        void setControlsVisibility(bool visibility)
        {
            var controls = new Control[] { RadGrid1, pnlFilter, ForwardToColleagueMain };
            foreach (var c in controls)
            {
                if (c != null)
                {
                    c.Visible = visibility;
                }
            }
        }

Maria Ilieva
Telerik team
 answered on 02 Sep 2010
2 answers
171 views
Hello,

I want to popup two different radalerts on my page depending on specific server side events.  However, I want a different image (by image I am referring to the yellow exclamation mark that the default radalert shows at the left of the text) to appear in each one of them.  For example, I want a checkmark on one and an exclamation mark on the other.

How can I accomplish this?? I have already made the radalert popup to work successfully, I only need to do the image thing.

Thank you in advance,
Manuel
sravanthi
Top achievements
Rank 1
 answered on 02 Sep 2010
7 answers
1.0K+ views
Hi 

I am working on rad grid. i want to get selected rows values using   <telerik:GridClientSelectColumn UniqueName="ClientSelectColumn" /> this checkbox column. I have read following example but i could not able to get values of particular selected row.

http://demos.telerik.com/aspnet-ajax/grid/examples/client/selecting/defaultcs.aspx
 Please guide me how i can traverse grid items if any row selected using this telerik:GridClientSelectColumn. 

Regards
Mohsin JK
Princy
Top achievements
Rank 2
 answered on 02 Sep 2010
3 answers
269 views
I am using a RadTreeView control to display pages in a website and allow users to drag and drop the pages to rearrange them. The TreeView control is inside of an UpdatePanel control inside of a modal popup panel (from the AJAX Control ToolKit), and I am handling the drop with server-side code.

So far, so good. User can drag and drop pages. However, during the drag, there is absolutely no visual indication of the node being dragged. In the live demo, the node text appears alongside the mouse cursor as it is moved, but in my project there is nothing to see.

How can I get some kind of indication that a node is being dragged as in the live demo? I don't see anything in the live demo code that does this. Am I missing something?

Tim
Yana
Telerik team
 answered on 02 Sep 2010
6 answers
140 views
Hi there,
In my video capture below, when I collapse and expand the splitter, the panelbaritems will be hidden.
Did I set something wrong here?

Video: http://www.xtopia.com.my/ximnettest/telerik/2010-08-06_1656.swf
URL: http://www.xtopia.com.my/ximnettest/menu_test.aspx

Code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="menu_test.aspx.vb" Inherits="menu_test" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<head runat="server">
    <title></title>
    <style type="text/css">
        html, body, form
        {
            overflow: hidden;
            height: 100%;
            width: 100%;
            margin: 0px;
            padding: 0px;
        }
    </style>
     
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="r" runat="server" />
    <telerik:RadSplitter Skin="Default" runat="Server" ID="mainSplit" Width="100%" Height="100%"
        Orientation="Horizontal" LiveResize="true">
        <telerik:RadPane ID="topPane" runat="server" Height="97">
            <div>
                Top</div>
        </telerik:RadPane>
        <telerik:RadSplitBar runat="server" ID="SplitBarTop" CollapseMode="Forward" Height="30px"
            EnableResize="False"  />
        <telerik:RadPane runat="server" ID="cPMain" Scrolling="none">
            <telerik:RadSplitter runat="server" ID="RadSplitter2" Skin="Default" BorderSize="0"
                BorderStyle="None" ResizeMode="Proportional">
                <telerik:RadPane runat="Server" ID="leftP" Width="230px" MinWidth="500" MaxWidth="350"
                    Scrolling="None" CssClass="relativePane">
                    <div style="height: 100%;">
                        <telerik:RadPanelBar runat="server" ID="mainPanel" Skin="Default" Height="100%" Width="100%"
                            EnableViewState="False" ExpandMode="FullExpandedItem" CollapseDelay="100">
                            <Items>
                          
                                <telerik:RadPanelItem Text="panel1" Expanded="true" Value="CMS" id="cmsPanel">
                                    <Items>
                                        <telerik:RadPanelItem>
                                            <ItemTemplate>
                                                <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="lp">
                                                     
                                                </telerik:RadAjaxPanel>
                                            </ItemTemplate>
                                        </telerik:RadPanelItem>
                                    </Items>
                                </telerik:RadPanelItem>
                           
                                <telerik:RadPanelItem Text="Panel 2" Value="PropMS" id="PropMSPanel">
                                    <Items>
                                        <telerik:RadPanelItem>
                                            <ItemTemplate>
                                                 
                                            </ItemTemplate>
                                        </telerik:RadPanelItem>
                                    </Items>
                                </telerik:RadPanelItem>
                              
                                <telerik:RadPanelItem Text="Panel 3" Value="SaleMS" id="SaleMSPanel">
                                    <Items>
                                        <telerik:RadPanelItem>
                                            <ItemTemplate>
                                                 
                                            </ItemTemplate>
                                        </telerik:RadPanelItem>
                                    </Items>
                                </telerik:RadPanelItem>
                                 
                                 
                                <telerik:RadPanelItem Text="p4" Expanded="false" Value="CustServ" >
                                    <Items>
                                        <telerik:RadPanelItem>
                                            <ItemTemplate>
                                                <div style="padding: 10px;">
                                                     
                                                </div>
                                            </ItemTemplate>
                                        </telerik:RadPanelItem>
                                    </Items>
                                </telerik:RadPanelItem>
                                 
                                 
                                <telerik:RadPanelItem Text="p5" Value="Media" id="MediaPanel">
                                    <Items>
                                        <telerik:RadPanelItem>
                                            <ItemTemplate>
                                              
                                            </ItemTemplate>
                                        </telerik:RadPanelItem>
                                    </Items>
                                </telerik:RadPanelItem>
                                 
                                <telerik:RadPanelItem Text="p6" Value="membersMS" >
                                    <Items>
                                        <telerik:RadPanelItem>
                                            <ItemTemplate>
                                                 
                                            </ItemTemplate>
                                        </telerik:RadPanelItem>
                                    </Items>
                                </telerik:RadPanelItem>
                                 
                                <telerik:RadPanelItem Text="7" Value="Poll">
                                    <Items>
                                        <telerik:RadPanelItem>
                                            <ItemTemplate>
                                                 
                                            </ItemTemplate>
                                        </telerik:RadPanelItem>
                                    </Items>
                                </telerik:RadPanelItem>
                                
                            </Items>
                        </telerik:RadPanelBar>
                    </div>
                </telerik:RadPane>
                <telerik:RadSplitBar runat="server" ID="RadSplitBar1" CollapseMode="Forward" Width="50" />
                <telerik:RadPane runat="Server" ID="cP">
                    Content
                </telerik:RadPane>
            </telerik:RadSplitter>
        </telerik:RadPane>
    </telerik:RadSplitter>
    </form>
</body>
</html>
Dobromir
Telerik team
 answered on 02 Sep 2010
1 answer
65 views
The FormDecorator when applied to a grid removes the checkboxes from HeaderContextMenu columns menu. I have the latest release as of Aug 31 2010.
Georgi Tunev
Telerik team
 answered on 02 Sep 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?