Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
94 views
I have a Radgrid control on a page that users a master/detail table to display data. In this scenario not every master record will have a detail record so I don't want to display the No Record line item.  This all works fine on the initial load of the page and grid, see image 1.  When a user selects a filter such a Region or Client is when I start having problems, see image 2.  All of the details rows are now displayed even it there is not data.  I've tried several of the code examples online but can't seem to get them working with the filters.

<telerik:RadGrid ID="rgVendors" runat="server" Skin="Web20" DataSourceID="edsVendors" 
                    ShowStatusBar="true" AutoGenerateColumns="False" AllowSorting="True" AllowMultiRowSelection="False"
                    AllowPaging="True" AllowAutomaticDeletes="true" GridLines="None" PageSize="25"
                    SortingSettings-EnableSkinSortStyles="false" OnDetailTableDataBind="rgVendors_DetailTableDataBind"
                    OnItemCommand="rgVendors_ItemCommand" OnItemEvent="rgVendors_ItemEvent" OnItemDataBound="rgVendors_ItemDataBound"
                    OnDeleteCommand="rgVendors_DeleteCommand" OnSelectedIndexChanged="rgVendors_SelectedIndexChanged"
                    OnPreRender="rgVendors_PreRender">
                    <MasterTableView DataKeyNames="ClientID,VendorID,VendorDetailID" Name="rgMaster" HierarchyLoadMode="ServerBind"
                        HierarchyDefaultExpanded="true" HeaderStyle-BackColor="#7FA5D7" ItemStyle-BackColor="#B0C4DE"
                        AlternatingItemStyle-BackColor="White">
                        <Columns>
                            <telerik:GridButtonColumn Text="Select" UniqueName="Select" CommandName="Select">
                            </telerik:GridButtonColumn>
                            <telerik:GridBoundColumn DataField="VendorDetailID" ReadOnly="true" Visible="false"
                                UniqueName="VendorDetailID">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Client.ClientID" ReadOnly="true" UniqueName="ClientID"
                                Visible="false">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn HeaderText="Client Name" DataField="Client.ClientName" UniqueName="ClientName"
                                HeaderStyle-Width="100px" ReadOnly="true">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn HeaderText="Vendor Name" DataField="Vendor.VendorName" UniqueName="VendorName"
                                ReadOnly="true">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn HeaderText="Service Provided" DataField="VendorService.ServiceName"
                                UniqueName="ServiceName" ReadOnly="true">
                            </telerik:GridBoundColumn>
                            <telerik:GridTemplateColumn HeaderText="Address" HeaderStyle-Width="150px">
                                <ItemTemplate>
                                    <asp:Label ID="Address" runat="server" Text='<%# Eval("Vendor.Address") %>'></asp:Label><br />
                                    <asp:Label ID="City" runat="server" Text='<%# Eval("Vendor.City") %>'></asp:Label><br />
                                    <asp:Label ID="State" runat="server" Text='<%# Eval("Vendor.State") %>'></asp:Label><br />
                                    <asp:Label ID="Zip" runat="server" Text='<%# Eval("Vendor.Zip") %>'></asp:Label>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn HeaderText="Phone<br>Email<br>Website" HeaderStyle-Width="100px">
                                <ItemTemplate>
                                    <asp:Label ID="Phone" runat="server" Text='<%# Eval("Vendor.Phone") %>'></asp:Label>
                                    <br />
                                    <asp:Label ID="Email" runat="server"><a href='mailto:<%# DataBinder.Eval(Container.DataItem, "Vendor.Email")%>'><%# DataBinder.Eval(Container.DataItem, "Vendor.Email")%></a></asp:Label>
                                    <br />
                                    <asp:HyperLink ID="hlWebsite" runat="server" NavigateUrl='<%# DataBinder.Eval(Container.DataItem, "Vendor.WebSite")%>'
                                        Text='<%# DataBinder.Eval(Container.DataItem, "Vendor.WebSite")%>' Target="_blank"></asp:HyperLink>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn HeaderText="Notes">
                                <ItemTemplate>
                                    <asp:Label ID="Notes" runat="server" Text='<%# Eval("Vendor.Notes") %>'></asp:Label>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridButtonColumn ConfirmText="Delete this Client Vendor?" ConfirmDialogType="RadWindow"
                                ConfirmTitle="Delete" ButtonType="ImageButton" ImageUrl="..\Icons\close.gif"
                                CommandName="Delete" />
                        </Columns>
                        <DetailTables>
                            <telerik:GridTableView DataKeyNames="VendorID,VendorContactID" Name="rgDetail" Width="100%"
                                runat="server" ItemStyle-BackColor="#6288C2" AlternatingItemStyle-BackColor="#6288C2"
                                AllowAutomaticDeletes="true">
                                <Columns>
                                    <telerik:GridButtonColumn Text="Edit Contact" UniqueName="Select" CommandName="Select">
                                    </telerik:GridButtonColumn>
                                    <telerik:GridBoundColumn DataField="VendorContactID" ReadOnly="true" UniqueName="ClientID"
                                        Visible="false">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridTemplateColumn HeaderText="Contact Name">
                                        <ItemTemplate>
                                            <asp:Label ID="ContactName" runat="server" Text='<%# Eval("Name") %>'></asp:Label>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridTemplateColumn HeaderText="Address" HeaderStyle-Width="150px">
                                        <ItemTemplate>
                                            <asp:Label ID="Address" runat="server" Text='<%# Eval("Address") %>'></asp:Label><br />
                                            <asp:Label ID="City" runat="server" Text='<%# Eval("City") %>'></asp:Label><br />
                                            <asp:Label ID="State" runat="server" Text='<%# Eval("State") %>'></asp:Label><br />
                                            <asp:Label ID="Zip" runat="server" Text='<%# Eval("Zip") %>'></asp:Label>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridTemplateColumn HeaderText="Phone">
                                        <ItemTemplate>
                                            <asp:Label ID="Phone" runat="server" Text='<%# Eval("Phone") %>'></asp:Label>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridTemplateColumn HeaderText="Email<br>Website" HeaderStyle-Width="100px">
                                        <ItemTemplate>
                                            <asp:Label ID="Email" runat="server"><a href='mailto:<%# DataBinder.Eval(Container.DataItem, "Email")%>'><%# DataBinder.Eval(Container.DataItem, "Email")%></a></asp:Label>
                                            <br />
                                            <asp:HyperLink ID="hlWebsite" runat="server" NavigateUrl='<%# DataBinder.Eval(Container.DataItem, "WebSite")%>'
                                                Text='<%# DataBinder.Eval(Container.DataItem, "WebSite")%>' Target="_blank"></asp:HyperLink>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridTemplateColumn HeaderText="Notes">
                                        <ItemTemplate>
                                            <asp:Label ID="Notes" runat="server" Text='<%# Eval("Notes") %>'></asp:Label>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridButtonColumn ConfirmText="Delete this Vendor Contact?" ConfirmDialogType="RadWindow"
                                        ConfirmTitle="Delete" ButtonType="ImageButton" ImageUrl="..\Icons\close.gif"
                                        CommandName="Delete" />
                                </Columns>
                            </telerik:GridTableView>
                        </DetailTables>
                    </MasterTableView>
                    <ExportSettings ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true"
                        HideStructureColumns="true" Pdf-PageBottomMargin=".5" Pdf-PageTopMargin=".5"
                        Pdf-PageLeftMargin=".5" Pdf-PageRightMargin=".5" Pdf-PaperSize="Legal" Pdf-PageWidth="356mm"
                        Pdf-PageHeight="216mm" />
                    <PagerStyle Position="TopAndBottom" />
                </telerik:RadGrid>
                <asp:EntityDataSource ID="edsVendors" runat="server" ConnectionString="name=ProNetData"
                    DefaultContainerName="ProNetData" EnableDelete="true" EnableUpdate="False" EntitySetName="VendorDetails"
                    AutoGenerateWhereClause="false" Include="Vendor,VendorService,Client,RiskAssessment"
                    Where="(it.Client.ClientID = @ClientID or @ClientID is null)
                            and (it.Vendor.VendorID = @VendorID or @VendorID is null)
                            and (it.VendorService.VendorServiceID = @VendorServiceID or @VendorServiceID is null)  
                            and (it.Client.RegionID = @RegionID or @RegionID is null)                         
                            and (it.RiskAssessment.IsCurrent = true)" OrderBy="it.Client.ClientName">
                    <WhereParameters>
                        <asp:ControlParameter ControlID="ddlRegionFilter" Name="RegionID" DbType="Int32"
                            ConvertEmptyStringToNull="true" />
                        <asp:ControlParameter ControlID="ddlClientNameFilter" Name="ClientID" Type="Int32"
                            ConvertEmptyStringToNull="true" />
                        <asp:ControlParameter ControlID="ddlVendorNameFilter" Name="VendorID" Type="Int32"
                            ConvertEmptyStringToNull="true" />
                        <asp:ControlParameter ControlID="ddlServiceNameFilter" Name="VendorServiceID" Type="Int32"
                            ConvertEmptyStringToNull="true" />
                    </WhereParameters>
                </asp:EntityDataSource>

protected void rgVendors_DetailTableDataBind(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)
   {
       GridDataItem dataItem = e.DetailTableView.ParentItem;
       int vendorID = int.Parse(dataItem.GetDataKeyValue("VendorID").ToString());
       int clientID = int.Parse(dataItem.GetDataKeyValue("ClientID").ToString());
       using (ProNetData d = new ProNetData())
       {
           var contacts = (from c in d.VendorContacts
                           where c.VendorID == vendorID && c.ClientID == clientID
                           select new
                           {
                               VendorID = c.VendorID,
                               VendorContactID = c.VendorContactID,
                               Name = c.Name,
                               Address = c.Address,
                               City = c.City,
                               State = c.State,
                               Zip = c.Zip,
                               Phone = c.Phone,
                               Email = c.Email,
                               Website = c.Website,
                               Notes = c.Notes
                           }).ToList();
           e.DetailTableView.DataSource = contacts;
       }
   }

protected void rgVendors_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
   {
       if (e.CommandName == RadGrid.ExpandCollapseCommandName)
       {
           foreach (GridItem item in e.Item.OwnerTableView.Items)
           {
               if (item.Expanded && item != e.Item)
               {
                   item.Expanded = false;
               }
           }
       }
   }

protected void rgVendors_PreRender(object sender, EventArgs e)
    {
        HideExpandColumnRecursive(rgVendors.MasterTableView);
  
    }
  
  
    public void HideExpandColumnRecursive(GridTableView tableView)
    {
        GridItem[] nestedViewItems = tableView.GetItems(GridItemType.NestedView);
        foreach (GridNestedViewItem nestedViewItem in nestedViewItems)
        {
            foreach (GridTableView nestedView in nestedViewItem.NestedTableViews)
            {
                if (nestedView.Items.Count == 0)
                {
                    nestedView.ParentItem.Expanded = false;
                }
  
                else
                {
                    nestedView.ParentItem.Expanded = true;
                }
            }
        }      
    }
Pavlina
Telerik team
 answered on 10 Feb 2011
0 answers
45 views
Hi,

 I am using LoadOnDemand Combo box. And I would like to set the Empty Message to a value that also appears in the items of the combobox.
When the Combobox is loaded, the EmptyMessage is shown correctly. When clicking on the dropdown the items are shown. After clicking outside the combobox and again on the dropdown arrow, the Text property of the combobox is also filled with the empty message value.

When I use an empty message that doesn't appear in the items, there is no problem.

Is there a solution for this problem?

I've added some printscreens of what happens
Picture 1: ComboBox is loaded (with EmptyMessage = "Delhaize") -> OK
Picture 2: Dropdown arrow is clicked -> OK
Picture 3: Click outside the combobox (EmptyMessage = "Delhaize") -> OK
Picture 4: Dropdown arrow is clicked (Text is automatically set equally to the EmptyMessage) -> NOT OK

Thx,
Jeff
Jeff
Top achievements
Rank 1
 asked on 10 Feb 2011
1 answer
107 views

I am seeing an odd problem with RajAjaxManager.  When I load my page clean, the page works fine.  However, when I reload the page in the same session, then IsAjaxRequest is not working.  It is not set to true.  

Below is what I am getting:

Message: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
Details: Error parsing near '
<!DOCTYPE html PUB'.
Line: 5
Char: 84093
Code: 0
URI: http://sitename/jscript/MicrosoftAjax.js

 

Maria Ilieva
Telerik team
 answered on 10 Feb 2011
5 answers
436 views
Hi everyone,

I have been banging my head against the wall today trying to find a solution to my problem so any help is much appreciated.

I have a radGrid that I have bound to a datatable server side and this datatable contains a column(img) of type "Image" in the back end (SQL Server 2005).  I have AutoGenerateColumns set to True as the application we are building is an interrogation tool to any database or table on our server, I therefore cannot add all of the columns manually.  Now, when the grid is displayed, the column "img" is not shown at all.

My first question is why this is the case and is there a setting that can be changed in order for the grid to automatically display these columns?  Even if there is, we have another requirement which I am unsure how to solve?

So, firstly we need the column adding to the grid, then if the DataRow has binary data in it we would like to display the word "BLOB" in the radGrid cell.  If the row does not have any data then the word "blob" in lower case should be displayed.  Lastly, we then need to add a click event to that cell that will fire up a new radWindow where we can display the binary data in a text field or binary editor.  (Potentially even show the image and allow them to change it?).

I have attached the code for completeness sake,

Look forward to hearing your responses.

Thanks,

M

<telerik:RadGrid ID="gdData" runat="server" AllowSorting="True"
            AllowPaging="True" AllowCustomPaging="True" Height="550px"
            PageSize="30" GridLines="None" PagerStyle-Visible="false"
            OnNeedDataSource="gdData_NeedDataSource" AllowFilteringByColumn="True"
            AutoGenerateEditColumn="True" Skin="WebBlue">
            <MasterTableView TableLayout="Auto" CommandItemDisplay="None" CurrentResetPageIndexAction="SetPageIndexToFirst"
                PageSize="30" EditMode="InPlace" AllowAutomaticDeletes="True"
                AllowAutomaticInserts="True" AllowAutomaticUpdates="True">
                <CommandItemSettings ExportToPdfText="Export to Pdf" />
                <ItemStyle Wrap="False" />
                <AlternatingItemStyle Wrap="False" />
            </MasterTableView>
            <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True" Scrolling-SaveScrollPosition="true">
                <Scrolling AllowScroll="True" UseStaticHeaders="True" ScrollHeight="100px" EnableVirtualScrollPaging="true" />
                <ClientEvents OnRowCreated="AddTooltips"  />
                <Resizing AllowColumnResize="True" EnableRealTimeResize="False" />
            </ClientSettings>
            <PagerStyle Visible="False" />
        </telerik:RadGrid>

And the code behind:
protected void gdData_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
    if (GetData)
    {
        // Find out how many records have already been shown so we can work out start position
        int startPos = gdData.CurrentPageIndex * gdData.PageSize;
 
        this.GridData = DataAccess.GetData(CurrentConStr, cbTable.SelectedValue, startPos, gdData.PageSize);
                 
        gdData.VirtualItemCount = this.GridData.recordcount;
        gdData.DataSource = this.GridData.Ds.Tables[0];
    }
}


Radoslav
Telerik team
 answered on 10 Feb 2011
7 answers
176 views
Hi,

is there any event that fires after an Appointment is beeing updated using Web Service binding? I would like to catch the Appointment Object that is returned in the response and do something with it. I see there is a request success but that doesn't return the response from the updated appointment request. 

thank you

regards,

jose
Jose Granja
Top achievements
Rank 1
 answered on 10 Feb 2011
10 answers
358 views

Is there an example for the hierarchy grid  with user control edit form or Form template edit form?

Thanks in advance.
Shinu
Top achievements
Rank 2
 answered on 10 Feb 2011
1 answer
114 views
hello everyone :)

under which circumstances are the client-side js methods set_activeRow and clearActiveRow working ??

i tried to hook up to OnRowSelected and to OnActiveRowChanged but to no success :(
When i look up the grid's dom properties, always _activeRow is emtpy (even when more than row is active/selected) and calling set_activeRow won't change that.

<ClientEvents OnGridCreated="OnGridCreated" OnRowClick="OnGridRowClick"  OnRowSelected="EventTest" />

within the handler "EventTest":
sender.clearActiveRow();
var element = sender.MasterTableView.get_dataItems()[1].get_element();
sender.set_activeRow(element);
sender.repaint();

thanks for your help,
hendrik
 
Radoslav
Telerik team
 answered on 10 Feb 2011
1 answer
91 views
I have a 'common dialog' that I use in lots of places in my app.

Rather than define it lots of times I put it in a control and access it that way. Works a treat.

Now I need to call that common dialog from another RadWindow (we'll call it PopupPage). And I need PopupPage to execute it's own copy of a JS function when the common dialog closes.

Now, I've worked out how to do all of that.

But, the PopupPage and the common dialog have to be managed by the same RadWindowManager for it to work.

Why? Because I'm using the techniques in this documentation article to call a function in one RadWindow (common dialog) from another RadWindow (PopupPage). The problem is that my common dialog needs to find the PopupPage to execute a script on it and it does it using this code ...
var popupPage = oWnd.get_windowManager().getWindowByName(callerName);      
popuPage.get_contentFrame().contentWindow.ProcessClose(args);

Now my code actually passes the name of the calling window (PopupPage) to the commondialog (as callerName) when it opens it. So knowing the window isn't a problem. The problem is that I want my commondialog to exist in a .ascx page which means that it either is managed by a different RadWindowManager or with no manager at all.

Either way, calling .get_windoiwManager().getWindowByName() isn't going to get me the results I'm looking for.

So, how do I call a a function on a page in one RadWindow from a page in another RadWindow when the 2 RadWindows are managed using different RadWindowManagers?

-- 
Frustrated of Grantham
Stuart Hemming
Top achievements
Rank 2
 answered on 10 Feb 2011
4 answers
70 views
Hi.

I am using radcompression on a .net 2 app which is also compressing viewstate into a session.

I want to exclude a page from being compressed (specifially the viewstate as it is 300k - it's a very big and silly page with 100''s of controls on).

whatever i do i cannot achieve this - the page size does nto change.

after adding

<

 

telerik.web.ui>

 

<

 

radCompression>

 

<

 

excludeHandlers>

 

<

 

add handlerPath="rptcurrentactivity.aspx" matchExact="false"/>

 

</

 

excludeHandlers>

 

</

 

radCompression>

 

</

 

telerik.web.ui>

 



into the web.config for the site, the size does not increase as i would expect. if i remove teh appbrowser file to stop copression, the page size is inclreaed by about 300k as i expect. any ideas?
James
Top achievements
Rank 1
 answered on 10 Feb 2011
1 answer
83 views
Hi,

I just wanted to ask a question, when I use the combobox on demand and I select an item, all the other items disappears. I have to erase the searching textbox to retrieve all the items.

When the combox box on demand is not on autopostback mode, the items persists and the item selected is highlighted. Is it normal?

Thanks.

Yana
Telerik team
 answered on 10 Feb 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?