Telerik Forums
UI for ASP.NET AJAX Forum
6 answers
266 views

I had this working, but someone I broke it. When I use the autogenerated update, cancel and delete links, they hang. The edit link opens the edit form with no issues.

This seems  to start when I tried to create the columns on my own. I wanted to change the link to a image button.

My code is below:

<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default">
</telerik:RadAjaxLoadingPanel>
<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="QUARK_PEERING" GridLines="None"
    ShowStatusBar="True" AllowPaging="True" Skin="Web20" Width="920px"  OnItemUpdated="RadGrid1_ItemUpdated"
    OnItemDeleted="RadGrid1_ItemDeleted" OnItemInserted="RadGrid1_ItemInserted" OnDataBound="RadGrid1_DataBound"
    AutoGenerateDeleteColumn="True" AutoGenerateEditColumn="True" AutoGenerateHierarchy="True" AllowAutomaticDeletes="True"
    AllowAutomaticInserts="True" AllowAutomaticUpdates="True">
    <PagerStyle Mode="NextPrevNumericAndAdvanced"></PagerStyle>
    <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True">
        <Selecting AllowRowSelect="True" />
        <Scrolling AllowScroll="True" UseStaticHeaders="True" />
    </ClientSettings>
    <AlternatingItemStyle BackColor="#DCE5BF" />
    <MasterTableView AutoGenerateColumns="false" DataSourceID="QUARK_PEERING" DataKeyNames="ASN"
        CommandItemDisplay="Top" Name="Peers" AllowFilteringByColumn="True">
        <CommandItemSettings ExportToPdfText="Export to Pdf" ShowExportToPdfButton="True"
            ShowAddNewRecordButton="True" ShowExportToCsvButton="True" ShowExportToExcelButton="True"
            ShowExportToWordButton="True"></CommandItemSettings>
        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
        </RowIndicatorColumn>
        <ExpandCollapseColumn Visible="True">
        </ExpandCollapseColumn>
        <DetailTables>
            <telerik:GridTableView runat="server" CommandItemDisplay="Top" DataSourceID="QUARK_PEERING2"
                AutoGenerateColumns="false" DataKeyNames="ID" Name="Peerings" AllowPaging="True"
                PageSize="3">
                <ParentTableRelation>
                    <telerik:GridRelationFields DetailKeyField="ASN" MasterKeyField="ASN" />
                </ParentTableRelation>
                <Columns>
                    <telerik:GridBoundColumn DataField="ASN" HeaderText="ASN" SortExpression="ASN" UniqueName="ASN"
                        HeaderStyle-Width="45px">
                        <HeaderStyle Width="45px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridDropDownColumn DataField="EXCHANGE_ID" DataSourceID="QUARK_EXCHANGES"
                        HeaderText="Exchange" ListTextField="EXCHANGE_NAME" ListValueField="EXCHANGE_ID"
                        UniqueName="EXCHANGE_ID" ColumnEditorID="GridDropDownColumnEditor1">
                    </telerik:GridDropDownColumn>
                    <telerik:GridBoundColumn DataField="IPv4_IP_01" HeaderText="IPv4 Peer IP 1" SortExpression="IPv4_IP_01"
                        UniqueName="IPv4_IP_01" HeaderStyle-Width="100px">
                        <HeaderStyle Width="100px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="IPv4_IP_02" HeaderText="IPv4 Peer IP 2" SortExpression="IPv4_IP_02"
                        UniqueName="IPv4_IP_02" HeaderStyle-Width="100px">
                        <HeaderStyle Width="100px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="IPv6_IP_01" HeaderText="IPv6 Peer IP 1" SortExpression="IPv6_IP_01"
                        UniqueName="IPv6_IP_01" HeaderStyle-Width="150px">
                        <HeaderStyle Width="150px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="IPv6_IP_02" HeaderText="IPv6 Peer IP 2" SortExpression="IPv6_IP_02"
                        UniqueName="IPv6_IP_02" HeaderStyle-Width="150px">
                        <HeaderStyle Width="150px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="MAX_PREFIX" HeaderText="Maximum # of Prefixes"
                        SortExpression="MAX_PREFIX" UniqueName="MAX_PREFIX" Visible="False">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="CURRENT_PREFIX" HeaderText="Current # of Prefixes"
                        SortExpression="CURRENT_PREFIX" UniqueName="CURRENT_PREFIX" HeaderStyle-Width="75px">
                        <HeaderStyle Width="75px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="MD5_PASSWORD" HeaderText="Peering Password" SortExpression="MD5_PASSWORD"
                        UniqueName="MD5_PASSWORD" Visible="False">
                    </telerik:GridBoundColumn>
                </Columns>
                <CommandItemSettings ShowAddNewRecordButton="True"></CommandItemSettings>
                <RowIndicatorColumn>
                    <HeaderStyle Width="20px" />
                </RowIndicatorColumn>
                <ExpandCollapseColumn>
                    <HeaderStyle Width="20px" />
                </ExpandCollapseColumn>
                <EditFormSettings>
                    <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                    </EditColumn>
                </EditFormSettings>
            </telerik:GridTableView>
        </DetailTables>
        <Columns>
            <telerik:GridBoundColumn DataField="COMPANY_NAME" HeaderText="Network Name" SortExpression="COMPANY_NAME"
                UniqueName="COMPANY_NAME">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="ASN" HeaderText="ASN" SortExpression="ASN" UniqueName="ASN">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="PRIMARY_CONTACT" HeaderText="Primary Contact"
                SortExpression="PRIMARY_CONTACT" UniqueName="PRIMARY_CONTACT" Visible="False">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="PRIMARY_EMAIL" HeaderText="Primary Email" SortExpression="PRIMARY_EMAIL"
                UniqueName="PRIMARY_EMAIL" Visible="False">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="PRIMARY_NUMBER" HeaderText="Primary Email" SortExpression="PRIMARY_NUMBER"
                UniqueName="PRIMARY_NUMBER" Visible="False">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="SUPPORT_CONTACT" HeaderText="Support Contact"
                SortExpression="SUPPORT_CONTACT" UniqueName="SUPPORT_CONTACT" Visible="False">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="SUPPORT_EMAIL" HeaderText="Support Email" SortExpression="SUPPORT_EMAIL"
                UniqueName="SUPPORT_EMAIL" Visible="False">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="SUPPORT_NUMBER" HeaderText="Support Number" SortExpression="SUPPORT_NUMBER"
                UniqueName="SUPPORT_NUMBER" Visible="False">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="PEERING_CONTACT" HeaderText="Peering Contact"
                SortExpression="PEERING_CONTACT" UniqueName="PEERING_CONTACT" Visible="False">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="PEERING_EMAIL" HeaderText="Peering Email" SortExpression="PEERING_EMAIL"
                UniqueName="PEERING_EMAIL" Visible="False">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="PEERING_NUMBER" HeaderText="Peering Number" SortExpression="PEERING_NUMBER"
                UniqueName="PEERING_NUMBER" Visible="False">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="PEERING_DB_LINK" HeaderText="PeeringDB Link"
                SortExpression="PEERING_DB_LINK" UniqueName="PEERING_DB_LINK" Visible="false">
            </telerik:GridBoundColumn>
        </Columns>
        <EditFormSettings>
            <EditColumn FilterControlAltText="Filter EditCommandColumn column">
            </EditColumn>
        </EditFormSettings>
    </MasterTableView>
    <PagerStyle Mode="NextPrevNumericAndAdvanced" />
    <FilterMenu EnableImageSprites="False">
    </FilterMenu>
    <HeaderContextMenu>
        <ExpandAnimation Type="OutBounce" />
    </HeaderContextMenu>
</telerik:RadGrid>
<telerik:GridDropDownListColumnEditor ID="GridDropDownColumnEditor1" runat="server"
    DropDownStyle-Width="110px" />
Tsvetoslav
Telerik team
 answered on 08 Feb 2011
6 answers
484 views
Hello!

I have built a grid report with edit and insert feature. so far everything is fine except for validation which I will do it next and the problem I face below:

I have two fileds --SID and Username ( we are not talking about database design problem here) which are related. so one sid to one username ( unique).

I have hidden sid and username in Edit form and use ForceExtractValue="InEditMode" which works in insert and edit. I used codebehind to hide them in edit mode and show them in insert mode.
    protected void RadGrid3_ItemCommand(object source, GridCommandEventArgs e)  
    {  
        ///I have to hide the fields SID and Username in the edit mode but show them in the insert mode ///  
        RadGrid grid = (source as RadGrid);  
        if (e.CommandName == RadGrid.InitInsertCommandName)  
        {  
            grid.MasterTableView.ClearEditItems();  
            RadGrid3.MasterTableView.GetColumn("SID").EditFormHeaderTextFormat = "SID:";  
            RadGrid3.MasterTableView.GetColumn("Username").EditFormHeaderTextFormat = "Username:";  
        }  
        if (e.CommandName == RadGrid.EditCommandName)  
        {  
            e.Item.OwnerTableView.IsItemInserted = false;  
            RadGrid3.MasterTableView.GetColumn("SID").EditFormHeaderTextFormat = "";  
            RadGrid3.MasterTableView.GetColumn("Username").EditFormHeaderTextFormat = "";  
        }    
 
        ///show export  
        if (e.CommandName == Telerik.Web.UI.RadGrid.ExportToExcelCommandName ||  
            e.CommandName == Telerik.Web.UI.RadGrid.ExportToWordCommandName ||  
            e.CommandName == Telerik.Web.UI.RadGrid.ExportToCsvCommandName ||  
            e.CommandName == Telerik.Web.UI.RadGrid.ExportToPdfCommandName)  
        {  
            ConfigureExport();  
        }  
    }  
 
    protected void RadGrid3_ItemDataBound(object sender, GridItemEventArgs e)  
    {  
        // update form     
        if (e.Item is GridEditFormItem && e.Item.IsInEditMode && e.Item.OwnerTableView.IsItemInserted == false)  
        {  
            GridEditFormItem editFormItem = (GridEditFormItem)e.Item;  
            editFormItem["SID"].Visible = false;  
            editFormItem["Username"].Visible = false;  
        }  
        // insert     
        else if (e.Item is GridEditFormInsertItem && e.Item.IsInEditMode && e.Item.OwnerTableView.IsItemInserted == true)  
        {  
            RadGrid3.MasterTableView.ClearEditItems();  
        }    
 
    } 


Now I want to when user input anything in sid or username field the other field is field with right data.
Or I want to hide sid and only show username in Insert mode. when user input username and I will get sid from database and add the value into the sid insert parameter then do insert.

How could I accomplish this.

Helmy
Top achievements
Rank 1
 answered on 08 Feb 2011
1 answer
211 views

I am trying to pass an ItemTemplate from an instance of a user control to a ListView ItemTemplate in a user control.

------------------- USER CONTROL .ASCX.CS -------------------
    [TemplateContainer(typeof(ItemTemplateContainer))]
    [PersistenceMode(PersistenceMode.InnerProperty)]
    [TemplateInstance(TemplateInstance.Single)]
    public ITemplate ItemTemplate { get; set; }
    public class ItemTemplateContainer : Control, INamingContainer { }

    protected void Page_Init()
    {
        if (ItemTemplate != null)
        {
            ItemTemplateContainer container = new ItemTemplateContainer();
            ItemTemplate.InstantiateIn(container);
            //THIS IS WHERE I AM STUCK - HOW DO I ASSIGN THE TEMPLATE FROM .ASPX TO THE RADLISTVIEW HERE?
        }
        else
            //If no custom template specified load default
            RadListView1.ItemTemplate = Page.LoadTemplate("/someDefault/Standard.ascx");
    }

------------------- USER CONTROL INSTANCE .ASPX -------------------
<uc:MyControl ID="MyControl1" runat="server" >
    <ItemTemplate>
            ...unique template...
    </ItemTemplate>
</uc:MyControl>

Thanks,
Jeremy

Iana Tsolova
Telerik team
 answered on 08 Feb 2011
1 answer
124 views
I have created node dynamically
Aspx code:-
<telerik:RadTreeView ID="RadTreeViewCategory" runat="server" OnNodeExpand="RadTreeViewCategory_NodeExpand"
                    OnNodeDataBound="RadTreeViewCategory_NodeDataBound" AllowNodeEditing="true" OnNodeEdit="RadTreeViewCategory_NodeEdit">
                    <NodeTemplate>
                        <div style="float: left; padding-right: 10px;">
                            <asp:ImageButton ID="lnkEdit" runat="server" OnClientClick='<%# string.Format("return showItemDetail(\"{0}\", \"{1}\", \"{2}\");", Eval("ItemID"), SurvBenchHistID, Eval("IsReportCreated")) %>'
                                ImageUrl="~/images/EditIcon.gif" ImageAlign="Middle" ToolTip="Edit in New Screen" />
                            <asp:Label ID="lblname" runat="server" Text='<%# Eval("ReportItemShortText") %>' /></div>
                        <div style="float: right; padding-left: 40px;">
                            <asp:Label ID="lblImportance" runat="server" Text='<%# Eval("Importance") %>' Visible="false" />
                            <asp:Label ID="lblItemID" runat="server" Text='<%# Eval("ItemID") %>' Visible="false" />
                            <asp:CheckBox ID="chkOptional" runat="server" Visible="false" />
                            <asp:Label ID="lblReportItemText" runat="server" Text='<%#Eval("ReportItemText") %>'
                                Visible="false" />
                            <asp:DropDownList ID="ddlImportance" runat="server" />
                        </div>
                    </NodeTemplate>
                    <DataBindings>
                        <telerik:RadTreeNodeBinding Expanded="True" />
                    </DataBindings>
                </telerik:RadTreeView>

C#
protected override void OnLoad(EventArgs e)
        {
            if (!IsPostBack)
            {
FillRadTree(dt);
}
}

private void FillRadTree(DataTable dt)
        {
            RadTreeViewCategory.DataTextField = "ReportItemShortText";
            RadTreeViewCategory.DataValueField = "ReportItemText";
            RadTreeViewCategory.DataFieldID = "ItemID";
            RadTreeViewCategory.DataFieldParentID = "ParentID";
            RadTreeViewCategory.DataSource = dt;
            RadTreeViewCategory.DataBind();
        }


protected void RadTreeViewCategory_NodeEdit(object sender, RadTreeNodeEditEventArgs e)
        {
            RadTreeNode nodeEdited = e.Node;
            string newText = e.Text;
            nodeEdited.Text = newText;
        }
Nikolay Tsenkov
Telerik team
 answered on 08 Feb 2011
5 answers
213 views
I've employed a technique similar to the one shown in this demo to create rich tooltips for my scheduler app.

My tooltip control has a toolbar in it. The toolbar has a OnClientButtonClicking event wired up. The tooltip also contains a RadScriptBlock with a correctly configured function to be called by the toolbar's OnClientButtonClicking event.

However, when my app runs and I hover over an event an error is generated along the lines of "ToolTipCommandItemClicking" is not defined.

Imagine my surprise.

After much messing about, I discovered that the only time the 'missing' JS function is found is if I move the definition out of the control used to create the tooltip and put it on the page containing the scheduler.

Whilst very odd, that wouldn't be the end of the world except for the fact that I can't call any other functions for detailing with the relevant toolbar button clicks which depend on the data loaded in to the tooltip control.

So, questions:
  1. Why won't the browser acknowledge that the called function does exist unless it is on the main page and not in the control used to populate the tooltip.
  2. How do I make it possible for the code that I have currently in the tooltip control to execute against the data loaded in the tooltip control itself?
For completeness, the markup for the control is show below.
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="CalendarEventToolTip.ascx.cs" Inherits="CalendarEventToolTip" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<telerik:RadScriptBlock runat="server" ID="RadScriptBlock1">
    <script type="text/javascript">
      function ToolTipCommandItemClicking(sender, e) {
          var btn = e.get_item();
          var cmdName = btn.get_commandName();
   
          e.set_cancel(true);
          switch (cmdName) {
              case "Export":
                  Export();
                  break;
   
              case "Print":
                  break;
   
              case "Mail":
                  break;
   
              case "RequestInvite":
                  break;
          }
      }
 
        function Export() {
            var AjaxRequestObject = GetAjaxRequestObject("Export", "<%=this.GetType().ToString()%>");
            AjaxRequestJson(AjaxRequestObject);
        }
    </script>
</telerik:RadScriptBlock>
<telerik:RadToolBar ID='RadToolBar1'
                    runat='server'
                    OnClientButtonClicking='ToolTipCommandItemClicking'
                    Width='100%'>
  <Items>
    <telerik:RadToolBarButton CommandName="Export"
                              ImageUrl="ExportToOutlook"
                              ToolTip="Export this event to Outlook"/>
    <telerik:RadToolBarButton CommandName="Print"
                              ImageUrl="Print"
                              ToolTip="Print event details"/>
    <telerik:RadToolBarButton CommandName="Mail"
                              ImageUrl="Mail"
                              ToolTip="Send an email message to event organiser"/>
    <telerik:RadToolBarButton CommandName="RequestInvite"
                              ImageUrl="RequestInvite"
                              ToolTip="Request an invitation"/>
  </Items>
</telerik:RadToolBar>
<div style="margin:5px 5px 0px 5px; font-size:12px; padding-bottom: 10px;">
  <div style="border-bottom:solid 1px #ccc;margin-bottom:9px;font-size:11px;">
    Starting on: <asp:Label runat="server"
                            ID="StartingOn"></asp:Label>
  </div>
  <asp:Literal runat="server"
               ID="Subject"></asp:Literal>
  <asp:Literal runat="server"
               ID="Description"></asp:Literal>
</div>

-- 
Confused of Grantham
Svetlina Anati
Telerik team
 answered on 08 Feb 2011
1 answer
68 views
am getting error in documen t(1,2) while am attempting to bind a xml to radtreeview
Nikolay Tsenkov
Telerik team
 answered on 08 Feb 2011
1 answer
117 views
i want to set font property of all rad controls ... how can i do ?
Prangadj
Top achievements
Rank 1
 answered on 08 Feb 2011
1 answer
122 views
I am trying to use radmenu to create a custom looking menu that will have 2nd and 3rd level dropdowns.

I've attached an image of what the menu should look like.

My question is, what direction should I go with trying to do this?

I believe I could
1) go with no skin, and just try to override things with CSS declarations.
2) go with a custom skin, and try to build everything I want in terms of appearance into the custom skin
3) use all item templates and define the elements in there.

With my really limited knowledge of these topics I'm leaning toward using item templates, where I think I should be able to control the look of these things pretty well, but I may be wrong.

Can anyone give me some advice?
Cori
Top achievements
Rank 2
 answered on 08 Feb 2011
1 answer
95 views
I have what on the surface looks like a fairly simple scenario. I have a textbox validated by a radinputmanager via a webservice. This allows the user to enter a produce code. If the code is valid then I want to populate some values with the textboxes textchanged event.

Heres what I have:

<asp:TextBox ID="ProductReferenceTextBox" runat="server" Text='<%#Bind("ProductReference") %>' MaxLength="8"
                            AutoPostBack="true" OnTextChanged="ProductReferenceTextBox_TextChanged" />
 
<t:RadInputManager ID="MainInputManager" runat="server">
        <t:TextBoxSetting BehaviorID="ProductReferenceBehavior" Validation-Method="ValidateProductCode"
            Validation-Location="ValidationServices/ProductService.asmx" Validation-ValidateOnEvent="All" Validation-IsRequired="true" />
protected void ProductReferenceTextBox_TextChanged(object Sender, EventArgs E)
{
TextBox oSender = (TextBox)Sender;
 
if (IocContainer.ProductDao.Exists(oSender.Text))
{
  Product eProduct = IocContainer.ProductDao.GetProduct(oSender.Text);
 
    GridDataInsertItem oContainer = (GridDataInsertItem)oSender.NamingContainer;
 
  Label oLabel = (Label)oContainer.Controls[5].Controls[0];
 
  oLabel.Text = eProduct.StockUnit;
  }
  }

This is fine if the code entered is valid, but if the code is invalid (i.e. the webservice validation fails) I don't want to postback to the textchanged event.

Is there any way to do this?

Thanks
Martin
Telerik team
 answered on 08 Feb 2011
1 answer
60 views
Hi.
I'm developing an ASP.NET app using the Q1 2010 version.
The app is deployed in a testing server in the local network. I've a page with 2 raddatepicker. When I test in Firefox I've no problem, but when I work in I.E. 8 (with proxy with exceptions for local URL's) the second raddatepicker doesn't work (the popup button is like "disabled"). Curiously when I disable the proxy option in I.E. 8, the compatibility view is active (I can use it with proxy) and both raddatepicker works fine.
I try to use the microsoft support solution including several ways to use emulation in I.E 7 (using headers in IIS or metatags in aspx files) but nothing works with proxy on.
Any suggestion?

Arseni
Top achievements
Rank 1
 answered on 08 Feb 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?