Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
73 views
Hello,
I am trying to filter a column in a radgrid with a custom filter template, based on the id´s of the objects and not the display names (in some cases we have entries with the name / display name)

My Code is:
<telerik:GridBoundColumn AllowFiltering="true" AllowSorting="true" DataField="Accountrole.Name"
                    HeaderText="<%$ Resources:Administration,Role %>" UniqueName="Accountrole.RoleId">
                    <FilterTemplate>
                        <telerik:RadComboBox ID="RadComboBoxRole" DataSourceID="RoleDataSource" DataTextField="Name"
                            DataValueField="RoleId" AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("Accountrole.RoleId").CurrentFilterValue %>'
                            runat="server" OnClientSelectedIndexChanged="RoleIndexChanged">
                            <Items>
                                <telerik:RadComboBoxItem Text="<%$ Resources:Basic,All %>" />
                            </Items>
                        </telerik:RadComboBox>
                        <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
                            <script type="text/javascript">
                                function RoleIndexChanged(sender, args) {
                                    var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                    tableView.filter("Accountrole.RoleId", args.get_item().get_value(), "EqualTo");
                                }
                            </script>
                        </telerik:RadScriptBlock>
                    </FilterTemplate>
                </telerik:GridBoundColumn>

Unfortunately the filtering does not work because my entity data source get athe following filterexpression from the grid (seen in debug mode):
RadGrid1.MasterTableView.FilterExpression  = "(it.Accountrole.Name = \"1\")" 
but it should be:
RadGrid1.MasterTableView.FilterExpression  = "(it.Accountrole.RoleId= \"1\")"

How can I tell the Grid to generate the correct filter expression?

Thanks in advance!
Maria Ilieva
Telerik team
 answered on 10 Jan 2011
1 answer
133 views
Hello 
I am using rad grid with allow scrolling true and usestaticheader true. when the scroll bars are not visible (less no. of rows), the header flickers 
on every event inside the grid. Anyone can please help me how can I solve this issue ?

thanks
Shobhit
Pavlina
Telerik team
 answered on 10 Jan 2011
2 answers
164 views
Hi,

I want to set a value in a control exists in a GridTemplateColumn, I've read many threads here about it and I figure out that  I must use ItemDataBound event instead,
but actually I can't, because I have a control shows a popup and the popup returns a value by a callback in the server,
so how can I deal with this situation?

The code:

protected void MyCustomControl_ItemSelected(string returnedValue)
{
    var control = (RadGrid1.EditItems[0] as GridEdittableItem).FindControl("MyCustomTextBox");
 
    if (control != null)
    {
       control.Text = returnedValue;
    }
}

Thanks in advance.


Homam
Top achievements
Rank 1
 answered on 10 Jan 2011
4 answers
253 views

Hi,
I try to add the Save and Cancel buttons to a RadEditor’s Toolbar by using the approach on the http://www.telerik.com/help/aspnet-ajax/addingsaveandcancelbuttonstoolbar.html page. When I run the code, I have the javascript error: “Microsoft JScript runtime error: 'RadEditorCommandList' is undefined”. Could you please let me know what I am missing?
Thank you

Dobromir
Telerik team
 answered on 10 Jan 2011
5 answers
173 views
Hello,
I have a RadNumeric textbox with the spinbuttons enabled.  When I change the value of the RadNumericTextBox using the spin buttons, the

window.onbeforeunload event fires.  Is there a way to prevent this from happening?

siva
Top achievements
Rank 1
 answered on 10 Jan 2011
1 answer
66 views

Hi
I use this code for invisibling components in grid when I click on "Add New Record" but in running program the error "Object reference not set to an instance of an object." occured. how can I write this code that not cause this error?

 

 

 

 

 

 

public partial class Permissions : System.Web.UI.Page

 

 

 

 

 

{

 

 

protected void Page_Load(object sender, EventArgs e)

 

{

rwmSuccessPM.Visible =

 

false;

 

}

 

 

private void InitalizeGroupGrid()

 

{

 

 

IQueryable<CDS.Savin.DataAccess.tS000Group> groups = CDS.Savin.Logic.BusinessObjects.UI.Groups.RetriveAll();

 

 

 

this.grdGroups.DataSource = groups;

 

 

 

this.grdGroups.DataBind();

 

}

 

 

protected void grdGroups_NeedDataSource(object source, GridNeedDataSourceEventArgs e)

 

{

 

 

IQueryable<CDS.Savin.DataAccess.tS000Group> groups = CDS.Savin.Logic.BusinessObjects.UI.Groups.RetriveAll();

 

 

 

this.grdGroups.DataSource = groups;

 

}

 

 

protected void grdGroups_EditCommand(object source, GridCommandEventArgs e)

 

{

 

 

 

 

 

 

 

GridDataItem item = (GridDataItem)e.Item;

 

rowindex = item.ItemIndex;

 

 

String id = item.GetDataKeyValue("GroupID").ToString();

 

Session[

 

"GroupID"] = id;

 

 

 

 

 

 

 

}

 

 

int rowindex = -1;

 

 

 

 

protected void grdGroups_ItemCommand(object source, GridCommandEventArgs e)

 

{

 

 

//GridEditFormInsertItem editItem = (GridEditFormInsertItem)grdGroups.MasterTableView.GetInsertItem();

 

 

 

 

 

 

 

// System.Web.UI.UserControl userControl = (System.Web.UI.UserControl)editItem.FindControl(GridEditFormItem.EditFormUserControlID);

 

 

 

 

 

 

 

//if (e.CommandName == RadGrid.EditCommandName)

 

 

 

 

 

 

 

//{

 

 

 

 

 

 

 

// GridDataItem item = (GridDataItem)e.Item;

 

 

 

 

 

 

 

// rowindex = item.ItemIndex;

 

 

 

 

 

 

 

//}

 

 

 

 

 

 

 

switch (e.CommandName)

 

{

 

 

case RadGrid.InitInsertCommandName:

 

{

 

 

 

 

System.Web.UI.

 

UserControl userControl = (System.Web.UI.UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);

 

 

 

 

 

 

 

RadGrid Grid1 = (RadGrid)userControl.FindControl("PermissionGrid");

 

Grid1.Visible =

 

false;

 

 

 

CheckBox chkWrite = (CheckBox)userControl.FindControl("chkWrite");

 

chkWrite.Visible =

 

false;

 

 

 

CheckBox chkRead = (CheckBox)userControl.FindControl("chkRead");

 

chkRead.Visible =

 

false;

 

 

 

CheckBox chkModify = (CheckBox)userControl.FindControl("chkModify");

 

chkModify.Visible =

 

false;

 

 

 

CheckBox chkDelete = (CheckBox)userControl.FindControl("chkDelete");

 

chkDelete.Visible =

 

false;

 

 

 

break;

 

}

 

 

 

case "Delete":

 

{

 

 

 

 

}

 

 

protected void grdGroups_PreRender(object sender, EventArgs e)

 

{

 

 

if (grdGroups.MasterTableView.IsItemInserted)

 

{

 

 

GridEditFormInsertItem editItem = (GridEditFormInsertItem)grdGroups.MasterTableView.GetInsertItem();

 

System.Web.UI.

 

UserControl userControl = (System.Web.UI.UserControl)editItem.FindControl(GridEditFormItem.EditFormUserControlID);

 

 

 

TextBox txtbox = (TextBox)userControl.FindControl("txtGroupName");

 

 

 

RadGrid Grid1 = (RadGrid)userControl.FindControl("PermissionGrid");

 

 

 

 

 

}

 

 

if (rowindex > -1)

 

{

 

 

GridEditFormItem editItem = (GridEditFormItem)grdGroups.MasterTableView.GetItems(GridItemType.EditFormItem)[rowindex];

 

 

 

GridDataItem item = (GridDataItem)editItem.ParentItem;

 

System.Web.UI.

 

UserControl userControl = (System.Web.UI.UserControl)editItem.FindControl(GridEditFormItem.EditFormUserControlID);

 

 

 

TextBox txtbox = (TextBox)userControl.FindControl("txtGroupName");

 

 

 

 

 

rowindex = 1;

 

 

IQueryable<CDS.Savin.DataAccess.tS000Group> GroupName = CDS.Savin.Logic.BusinessObjects.UI.Groups.RetriveGroupName(int.Parse(item.Cells[3].Text));

 

txtbox.Text = GroupName.First().GroupName;

 

 

RadGrid Grid1 = (RadGrid)userControl.FindControl("PermissionGrid");

 

Grid1.DataSource = CDS.Savin.Logic.BusinessObjects.UI.

 

GroupPermissions.Retrieve(int.Parse(item.Cells[3].Text));

 

Grid1.DataBind();

 

 

 

 

 

 

 

 

 

 

 

 

rowindex = -1;

}

 

 

 

 

}

 

}

 

Princy
Top achievements
Rank 2
 answered on 10 Jan 2011
8 answers
193 views
Dear Telerik hello,

i have a problem with the values, in Stacked Bar (Horizontal orientation). See Attached image.
Can i change the position of the values to the end of the second bar (with different color), like the example in the image??

How can i fix this??
ASAP please.

Thank you in advance for your time.

Best Regards,
George.
Navarino Technology Dept.
Technology
Top achievements
Rank 1
 answered on 10 Jan 2011
1 answer
66 views
I am trying to click a submit button after loading and pre-populating and pre-selecting a value of two radcomboboxes.

If I try it with this code: (the setting for the second radcombobox is: EnableAutomaticLoadOnDemand="True" )

<tr>
                    <td colspan="2"> <b> Supervisor Name </b></td>
                    <td colspan="3">
                        <asp:HiddenField ID="CRAFT_CODE_Textbox" runat="server" value="H" />
                        <asp:HiddenField ID="SUPV_ID_TextBox" runat="server" />
                        <br />
                        <telerik:RadComboBox ID="wcOfficerName" Runat="server" 
                            DataSourceID="sdsOfficer" DataTextField="FULL_NAME" 
                            DataValueField="SUPV_ID" EnableAutomaticLoadOnDemand="False" 
                            EnableItemCaching="True" EnableLoadOnDemand="False" 
                            EnableVirtualScrolling="False" Filter="StartsWith" ItemsPerRequest="-1" 
                            MarkFirstMatch="False" Width="279px" ShowMoreResultsBox="False" 
                            Skin="Office2007" LoadingMessage="Loading Please Wait..." EmptyMessage="Please Select Supervisor">
                        </telerik:RadComboBox>
                    </td>
                    </tr>
                    <tr>
                    <td colspan="2"> <b> Employee Name</b></td>
                    <td colspan="3">
                        <asp:HiddenField ID="EMPL_ID_TextBox" runat="server" />
                        <br />                   
                        <telerik:RadComboBox ID="wcEmployeeName" Runat="server" 
                            DataSourceID="sdsEmployees" DataTextField="FULL_NAME" 
                            DataValueField="PERSON_ID" EnableAutomaticLoadOnDemand="True" 
                            EnableItemCaching="True" EnableLoadOnDemand="False" 
                            EnableVirtualScrolling="False" Filter="StartsWith" ItemsPerRequest="-1" 
                            MarkFirstMatch="False" Width="279px" ShowMoreResultsBox="False" 
                            Skin="Office2007" LoadingMessage="Loading Please Wait..." EmptyMessage="Please Select Employee">
                        </telerik:RadComboBox>
                       <br />
                    </td>
                </tr>
It works.

However if I change the second radcombobox setting to EnableAutomaticLoadOnDemand="False"  then it errors out when I click the "submit" button.

For the error please see attached "error.jpg"

To set the selectedvalue of each rad box I use the following code in the page load event:
Me.wcEmployeeName.SelectedValue = dataset.Tables(0).Rows(0)(4)
 Me.wcOfficerName.SelectedValue = dataset.Tables(0).Rows(0)(3)

Please help!
Simon
Telerik team
 answered on 10 Jan 2011
2 answers
204 views

I currently am using a Repeater (below) and I want to replace it with a RadGrid control.  

Can I create multi-row headers with a RadGrid control? 

I have other more complex header that span rows etc., are they supported? 
   
     
<asp:Repeater ID="Repeater1" runat="server" EnableViewState="False">  
            <HeaderTemplate> 
                <p> 
                <table width="95%" border="1" cellpadding="3" cellspacing="0">  
                <thead> 
                    <tr class="colTitle">  
                        <th colspan="5" align="center">  
                            <br/> 
                            <%# title%> 
                            <br/> 
                            <br/> 
                            For: <%# reportMonthHeader%> 
                            <br/> 
                            <br/> 
                            Process Date: <%# processDateHeader %> 
                            <br/> 
                            <br/> 
                        </th> 
                    </tr> 
                    <tr class="colTitle">  
                        <th style="font-size: xx-small;" align="center" valign="bottom">  
                            Contract ID  
                        </th> 
                        <th style="font-size: xx-small;" align="center" valign="bottom">  
                            Contract Name  
                        </th> 
                        <th style="font-size: xx-small;" align="center" valign="bottom">  
                            Total Number of Transactions Sent  
                        </th> 
                        <th style="font-size: xx-small;" align="center" valign="bottom">  
                            Total Number of Transactions Received on Time  
                        </th> 
                        <th style="font-size: xx-small;" align="center" valign="bottom">  
                            Percent of Transactions Received on Time  
                        </th> 
                    </tr> 
                    <tr class="colTitle">  
                        <th style="font-size: xx-small;" align="center" valign="bottom">  
                            A  
                        </th> 
                        <th style="font-size: xx-small;" align="center" valign="bottom">  
                            B  
                        </th> 
                        <th style="font-size: xx-small;" align="center" valign="bottom">  
                            C  
                        </th> 
                        <th style="font-size: xx-small;" align="center" valign="bottom">  
                            D  
                        </th> 
                        <th style="font-size: xx-small;" align="center" valign="bottom">  
                            E  
                        </th> 
                    </tr> 
                </thead> 
                <tbody>                      
            </HeaderTemplate> 
            <ItemTemplate> 
                <tr class="<%# Container.ItemIndex % 2 == 0 ? "tblalt" : "" %>">  
                    <td width="15%" style="font-size: xx-small;" align="center" valign="middle">  
                        <%# DataBinder.Eval(Container.DataItem, "ContractId")%> 
                    </td> 
                    <td width="40%" style="font-size: xx-small;" align="center" valign="middle">  
                        <%# DataBinder.Eval(Container.DataItem, "ContractName")%> 
                    </td> 
                    <td width="15%" style="font-size: xx-small;" align="center" valign="middle">  
                        <%# DataBinder.Eval(Container.DataItem, "TotEnrollSent")%> 
                    </td> 
                    <td width="15%" style="font-size: xx-small;" align="center" valign="middle">  
                        <%# DataBinder.Eval(Container.DataItem, "TotRcvdOnTime")%> 
                    </td> 
                    <td width="15%" align="center" valign="middle" style='<%#  (bool)(DataBinder.Eval(Container.DataItem, "HighlightPctRcvdOnTime"))?"font-size:xx-small;font-weight:bold;color:red;text-decoration:underline;":"font-size: xx-small;"%>'>  
                         <%# DataBinder.Eval(Container.DataItem, "PctRcvdOnTime")%> 
                    </td> 
                </tr> 
            </ItemTemplate> 
            <FooterTemplate> 
                </tbody> 
                </table> 
                </p> 
            </FooterTemplate> 
        </asp:Repeater> 
 
Saranya
Top achievements
Rank 1
 answered on 10 Jan 2011
3 answers
62 views
In attempting to make the enter key simulate a click on a button I used the following as a reference: http://www.telerik.com/community/forums/aspnet-ajax/ajax/defaultbutton-and-radajaxpanel.aspx

I put the javascript in a RadCodeBlock and set the body's onkeydown event to call it.  Now the form just keeps loading and never completes.
Here is the entire code (it isn't very large)  The button is on a RadAjaxPanel in the referenced SearchControl.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="HeadSearch" runat="server">
    <title>General Search</title>
    ...
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">  
    <script type="text/javascript">  
    function keyDown(e)  
    {  
        if(e.keyCode == 13)  
        {  
            var ajaxPanel = $find("<%= RadAjaxPanelSearch.ClientID %>");
            var searchButton = $find("<%= ButtonSearch.ClientID %>");
            searchButton.click();
        }  
    }  
    </script>
    </telerik:RadCodeBlock>
</head>
<body onkeydown="keyDown(event);" onload="hideLoading();">
    <form id="FormSearch" runat="server">
    <telerik:RadScriptManager ID="RadScriptManagerPage" runat="server" OnAsyncPostBackError="RadScriptManagerPage_AsyncPostBackError"
        EnableScriptCombine="true" OutputCompression="AutoDetect" EnablePageMethods="true">
        <Scripts>
            <asp:ScriptReference Path="~/Scripts/M5.js" NotifyScriptLoaded="true" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
        </Scripts>
    </telerik:RadScriptManager>
    <asp:Panel ID="PanelGeneralSearch" runat="server" CssClass="headingPanel" TabIndex="-1"
        BorderWidth="0" BorderStyle="None">
        <asp:Label ID="HeadingLabel" runat="server" CssClass="headingLabel" TabIndex="-1"></asp:Label>
        <table class="pageContainer">
            <tr>
                <td valign="top">
                    <uc1:SearchControl ID="SearchControl" runat="server" />
                </td>
            </tr>
        </table>
    </asp:Panel>
    </form>
</body>
</html>

old code:
    ...
    <script type="text/javascript">
        function CheckKey() {
            if (event.keyCode == 13) {

                return false;
            }
            return true;
        }

    </script>
    ...
<body onkeydown="return CheckKey(event);" onload="hideLoading();">
Maria Ilieva
Telerik team
 answered on 10 Jan 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?