Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
81 views
hi,

another question: 

the OnClientContextMenuItemClicked event is not fired after refreshing the control with radxmlhttppanel...the events which are registered to to contextmenucontrol itself are working correctly, but OnClientContextMenuItemClicked and OnClientContextMenuShown are not fired after the ajax refresh!

regards,
ingemar
Ingemar
Top achievements
Rank 1
 answered on 13 Oct 2010
1 answer
257 views
Hi,
I have a RadGrid with autogenerated columns.  As the rows are building, I need to add a label and a dropdownlist to one of the columns.  Everything works fine if I put everything in ItemDataBound and have my grid hierarchyloadmode=client (code snippet #1).  This is slow, so I want to use ServerBind.  In doing that, my controls disappear on postback.  I have found examples where I should create my control in ItemCreated and ItemDatabound, but this does not seem to work for me (code snippet #2).  I get an object reference error because it cannot find the control.  What am I doing wrong?

//code snippet #1 - this works when in hierarchyloadmode=Client
protected
void grdVerification_ItemDataBound(object sender, GridItemEventArgs e) 
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem item = (GridDataItem)e.Item;
  
                //build and set the value for the Escalators
                GridTableCell cellEscalatorID = (GridTableCell)item["EscalatorID"];
                GridTableCell cellEscalatorName = (GridTableCell)item["EscalatorName"];
                //add a label to store the EscalatorName
                Label lblEscalatorName = new Label();
                lblEscalatorName.ID = "lblEscalatorName";
                lblEscalatorName.Text = cellEscalatorName.Text;
                cellEscalatorName.Controls.Add(lblEscalatorName);
  
                DropDownList ddlEscalators = new DropDownList();
                ddlEscalators.DataSourceID = "dsrcEscalators";
                ddlEscalators.DataTextField = "EscalatorName";
                ddlEscalators.DataValueField = "EscalatorID";
                ddlEscalators.Attributes.Add("style", "display:none");
                ddlEscalators.Attributes.Add("OnChange", "ddlEscalators_Change(this)");
                ddlEscalators.ID = "ddlEscalators";
                cellEscalatorName.Controls.Add(ddlEscalators);
                (item.FindControl("ddlEscalators") as DropDownList).SelectedValue = cellEscalatorID.Text;
//code snippet #2 - this errors when it can't find the control.  As you can see, I tried calling it by referencing
// the cell's controls and the item's controls.  Neither approach works.
protected
void grdVerification_ItemCreated(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem item = (GridDataItem)e.Item;
  
                //build and set the value for the Escalators
                GridTableCell cellEscalatorName = (GridTableCell)item["EscalatorName"];
                //add a label to store the EscalatorName
                Label lblEscalatorName = new Label();
                lblEscalatorName.ID = "lblEscalatorName";
                lblEscalatorName.BackColor = System.Drawing.Color.Orange;
                cellEscalatorName.Controls.Add(lblEscalatorName);
  
                DropDownList ddlEscalators = new DropDownList();
                ddlEscalators.DataSourceID = "dsrcEscalators";
                ddlEscalators.DataTextField = "EscalatorName";
                ddlEscalators.DataValueField = "EscalatorID";
                ddlEscalators.Attributes.Add("style", "display:none");
                ddlEscalators.Attributes.Add("OnChange", "ddlEscalators_Change(this)");
                ddlEscalators.ID = "ddlEscalators";
                cellEscalatorName.Controls.Add(ddlEscalators);
                  
            }
  
        }
         
        protected void grdVerification_ItemDataBound(object sender, GridItemEventArgs e) 
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem item = (GridDataItem)e.Item;
  
                ////build and set the value for the Escalators
                GridTableCell cellEscalatorID = (GridTableCell)item["EscalatorID"];
                GridTableCell cellEscalatorName = (GridTableCell)item["EscalatorName"];
                (cellEscalatorName.FindControl("lblEscalatorName") as Label).Text = cellEscalatorName.Text;
  
                (item.FindControl("ddlEscalators") as DropDownList).SelectedValue = cellEscalatorID.Text;

 
Princy
Top achievements
Rank 2
 answered on 13 Oct 2010
1 answer
93 views
Hi
I am a newbie, so this may be trivial.
I am using your login window example, and failed on the get-go.
I took the TelerikLoginWebForm and added a login template.
I expect to see "DGV" when I am logged in, and nothing, when I am not.
However, DGV does appear when I am logged in, but fails to disappear when I logout. 
As if the logout event does not modify the LoginView.
The LoginControl does change when I hit Logout.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TelerikLoginWebForm.aspx.cs" Inherits="TelerikLoginWebForm" %>
 
<%@ Register src="LoginControl.ascx" tagname="LoginControl" tagprefix="uc1" %>
 
<%@ 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">
 
<head runat="server">
    <title></title>
    <telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" />
</head>
<body>
    <form id="form1" runat="server" >
    <asp:ScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <%--Needed for JavaScript IntelliSense in VS2010--%>
            <%--For VS2008 replace RadScriptManager with ScriptManager--%>
<%--            <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>
    </asp:ScriptManager>
     
    <script type="text/javascript">
        //Put your JavaScript code here.
    </script>
     
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="LoginView">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="LoginView" UpdatePanelHeight="" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
     
    <div>
        <uc1:LoginControl ID="LoginControl1" runat="server" />
        <asp:LoginView ID="LoginView" runat="server">
            <AnonymousTemplate>
             
            </AnonymousTemplate>
            <LoggedInTemplate>
                DGV
            </LoggedInTemplate>
        </asp:LoginView>
    </div>
    </form>
</body>
</html>

Maria Ilieva
Telerik team
 answered on 13 Oct 2010
5 answers
213 views
I have a radgrid with an objectdatasource that binds to an entity list.
We are trying to insert a new record, but the insert command never fires. 
The update and delete commands work perfectly it's just the insert that is failing.

We've got allowautomaticinsert = true, and the commandname of the button is "insert".

Please advise.
Pavlina
Telerik team
 answered on 13 Oct 2010
3 answers
59 views
Dea Telerik-Team

After a client ajax request via Javascript I want to ajaxfied the title of the page (this.Page.Title), I set the new title but after the ajax request the title isn't to the new string/name.

Any idea how I can implemented this?

The UpdatePageHead property is set to true.

Kind regards
Christian
Maria Ilieva
Telerik team
 answered on 13 Oct 2010
3 answers
184 views
Hey,

I am not able to Populate dropdownlist with sql data source--aspx is

<telerik:GridDropDownColumn HeaderText="Items" UniqueName="column1" DataSourceID="SqlDataSource1"
                     ListTextField="ProductName" ListValueField="Pid" DataField="ProductName" >
                    </telerik:GridDropDownColumn>
Ans datasource is--
<asp:SqlDataSource ID="SqlDataSource1" runat="server" DataSourceMode="DataReader"
            ConnectionString="<%$ ConnectionStrings:ChalkHillConnectionString3 %>"
            SelectCommand="SELECT [ProductName] FROM [tblProducts] ORDER BY [Pid]"></asp:SqlDataSource>
I am trying to populate ddl from ProductName column of my tblProducts.
Does'nt seem to be workin'.I am getting this error--

'System.Data.Common.DataRecordInternal' does not contain a property with the name 'Pid'

Plz help..
Thanks
Amit
Pavlina
Telerik team
 answered on 13 Oct 2010
3 answers
269 views
Hey,

I am new with telerik controls,and can't understand procedure required for binding a RadGrid.I've made a grid,this is .aspx file--

<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False"
    GridLines="None" OnItemDataBound="RadGrid1_ItemDataBound">
    <MasterTableView>
        <RowIndicatorColumn>
            <HeaderStyle Width="20px" />
        </RowIndicatorColumn>
        <ExpandCollapseColumn>
            <HeaderStyle Width="20px" />
        </ExpandCollapseColumn>
        <Columns>
            <telerik:GridTemplateColumn HeaderText="Items" UniqueName="ItemColumn">
                <ItemTemplate>
                    <asp:Label ID="lblItemName" runat="server" />
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:DropDownList ID="ddlItems" runat="server" DataSourceID="SqlDataSource1" OnSelectedIndexChanged="ddlItems_SelectedIndexChanged" />
                </EditItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn HeaderText="Rate" UniqueName="RateColumn">
                <ItemTemplate>
                <asp:Label ID="lblRate" runat="server" />
                </ItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn HeaderText="Quantity" UniqueName="QuantityColumn">
                <ItemTemplate>
                    <asp:Label ID="lblQuantity" runat="server" />
                </ItemTemplate>
                <EditItemTemplate>
                    <telerik:RadTextBox ID="txtQuantity" runat="server" />
                </EditItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn HeaderText="Amount" UniqueName="AmountColumn">
                <ItemTemplate>
                    <asp:Label ID="lblAmount" runat="server" />
                </ItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridButtonColumn HeaderText="Done" Text="Done" UniqueName="Donecolumn">
            </telerik:GridButtonColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

I want the grid to be in edited mode initially on the page load,such that it contains a row in which 1st column has dropdownlist from which person selects the item and next column contains a label which will get the rate of the selected item in ddl on selectedIndex Changed of ddl.I tried it with Item bound event like--.cs file
protected void ddlItems_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (ddlItems.SelectedIndex > 0)
            {
                DataSet ds = objSQLHelper.GetProductDetails("select * from tblProducts where Pid=" + ddlItems.SelectedValue);
                if (ds != null)
                {
                    lblRate.Text = ds.Tables[0].Rows[0]["Rate"].ToString();
                }
            }
        }
        protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if ((e.Item is GridEditFormItem) && (e.Item.IsInEditMode))
            {
                GridEditFormItem editform = (GridEditFormItem)e.Item;
                DropDownList ddlItems = (DropDownList)editform.FindControl("ddlItems");
                ddlItems.DataSource = ds;
                ddlItems.DataTextField = "ProductName";
                ddlItems.DataValueField = "Pid";
                ddlItems.DataBind();
            }
        }
 but that did'nt worked.I just want to show an empty edited RadGrid Initially At page load,where person places order by selecting values fom ddl and placing quantity in textbox.It not showing Grid in the browser.What to do?..And What's required thet i'm missing.Need some help...

Thanks
Amit.
Radoslav
Telerik team
 answered on 13 Oct 2010
3 answers
132 views
Hi, I've some troubles using the GridMaskedColumn from code behind with version 2010.1.309.35.

Here is how I add dynamically my column:
GridMaskedColumn maskColumn = new GridMaskedColumn();  
columns.Add(maskColumn);  
 
maskColumn.UniqueName = myDataField;  
maskColumn.HeaderText = myHeaderText;  
 
maskColumn.Mask = myMask;  
maskColumn.DataField = myDataField;  
maskColumn.SortExpression = myDataField;  
maskColumn.ShowSortIcon = true;  
maskColumn.ShowFilterIcon = true;  
maskColumn.ReadOnly = !editable; 

I'm using a "aaaa" mask to make sure it's the easiest as possible on a varchar(50) field which has valid values.  I have the same problem when table is empty.

It works great when displayed.  The filters are working correctly with defined mask(while testing something else than 'aaaa') but as soon as I click the edit button, I get an : Cannot create column with the specified type name: GridMaskedColumn

Here is the stack of the error. 
[GridException: Cannot create column with the specified type name: GridMaskedColumn]  
   Telerik.Web.UI.GridColumnCollection.CreateColumnFromTypeName(String columnTypeName) +1211  
   Telerik.Web.UI.GridColumnCollection.System.Web.UI.IStateManager.LoadViewState(Object savedState) +428  
   Telerik.Web.UI.GridTableView.LoadStructureState(Object SavedStructure) +354  
   Telerik.Web.UI.RadGrid.LoadTableViewStructure(IEnumerator stateEnumerator, GridTableView tableView) +101  
   Telerik.Web.UI.RadGrid.LoadViewState(Object savedStateObject) +276  
   System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +183  
   System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134  
   System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +221  
   System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134  
   System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +221  
   System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134  
   System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +221  
   System.Web.UI.Page.LoadAllState() +312  
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1661  
 
 

I checked and I'm not doing anything special with the column, even not providing mask gives the same error.

Thanks for your help solving this issue.
Mira
Telerik team
 answered on 13 Oct 2010
1 answer
67 views
Hello,

I am unable to download trainer tutorial and getting 403 error

I am using credentials of rrcholan.k@chintainfo.com

Please advice.

Thank you

Regards
Raj
Mira
Telerik team
 answered on 13 Oct 2010
2 answers
316 views
Hi all,
I was just using fiddler2 to investigate what is going over the wire when I detected a 500 error code. The error message indicates that the file ImageHandler.ashx is located in the special directory 'App_Themes' which would be forbidden.

So I checked that directory but couldn't find that file there. The only thing I could detect was a css-file with an entry like:

.RadForm_formdecorator_calculator.rfdTextarea textarea:hover {
    color: rgb(178, 28, 27);
    background-color: transparent;
    background-image: url('ImageHandler.ashx?mode=get&suite=aspnet-ajax&control=FormDecorator&skin=formdecorator_calculator&file=verlauf.png&t=769399777');

}

It seems that the url is causing the trouble. So I guess this stems from the usage of the stylebuilder. Has anybody experienced the same problem and even better - knows how to solve this issue ?

Thanks a lot,
Wolfgang
Wolfgang Sigel
Top achievements
Rank 1
 answered on 13 Oct 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?