Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
76 views
I have a WCF service internal to my Solution and is a Service Reference to the Client, so my Question is how do I set the Path on the Websettings and the Method for my Combobox?
Simon
Telerik team
 answered on 24 Sep 2010
1 answer
107 views

I am using the RadXmlHttpPanel to load a dropdown based on teh value of other dropdown. Below is my case.

I have a state comobo. when user select a value then the county dropdown should list the counties for that state. Both State and County is coming from the DB.

I have the county dropdown in the RadXmlHttpPanel.
My problem is. When the choose the state dropdown for the first time I am seeing the counties populated correctly and I am able to choose from the county list.
But then when I try to change the state then I am not able to do with the mouse. The list of state show in the dropdown but not able to choose from the list. But I am able to use the key board and select and the county dropdown populates accordingly.

Here is the code I am using.

<telerik:RadComboBox ID="cmbState" runat="server" Width="50px" 
    OnClientSelectedIndexChanged="ComboChanged">                                   
</telerik:RadComboBox>
                                  
                                  
<telerik:RadXmlHttpPanel ID="CountyXmlHttpPanel" runat="server" 
    OnServiceRequest="CountyXmlHttpPanel_ServiceRequest" EnableClientScriptEvaluation ="true">
    <telerik:RadComboBox ID="cmbCounty" runat="server" 
        Width="100px" DropDownWidth="250px" >
    </telerik:RadComboBox>
</telerik:RadXmlHttpPanel>      
  
  
function ComboChanged(sender, args) {
    var foundPanel = $find("<%=CountyXmlHttpPanel.ClientID %>");
    var stateCombo = $find("<%= cmbState.ClientID %>");
    var stateVal = stateCombo.get_value();
    foundPanel.set_value(stateVal);
}
  
  
 protected void CountyXmlHttpPanel_ServiceRequest(object sender, Telerik.Web.UI.RadXmlHttpPanelEventArgs e)
        {
            //Bind county here
        }

 

Thanks

 

Pero
Telerik team
 answered on 24 Sep 2010
1 answer
116 views
Hi, Is it possible to assign different templates to different nodes based on the value of a database field? I am binding the treeview to the results of a stored procedure.

Thanks in advance!
Nikolay Tsenkov
Telerik team
 answered on 24 Sep 2010
4 answers
552 views
Hi Everyone,

I am really stuck on how to find a text box control in edit item template after clicking a custom command item inside detail table.

requirement:
- after clicking "Edit" command item in detail table named "Detail2", show the text box "tbVisitSortOrder" 

Please check my aspx code below.
<DetailTables>
                    <rad:GridTableView Name="Detail2"  DataKeyNames="cp_id" DataMember="visit"  CommandItemDisplay="Top" EditMode="InPlace" Width="100%">
                    <CommandItemTemplate>
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                                <td style="width:60%">
                                    <div style="padding:3px 4px 3px 4px">
                                        <table border="0" cellpadding="1" cellspacing="1">
                                            <tr style="font: normal 11px tahoma, Verdana, Helvetica, Sans-serif;vertical-align:middle">
                                                <td>
                                                    <div class="toolbarIconDivider">|</div>
                                                </td>
                                                <td>
                                                    <asp:LinkButton ID="btnAdd" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="InitInsert"><img style="border:0px" alt="" src="../images/addemail.gif" /> Add</asp:LinkButton>
                                                    <asp:LinkButton ID="lnkPerformInsert" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="PerformInsert" Visible="false"><img style="border:0px" alt="" src="../images/save.gif" /> Save</asp:LinkButton>
                                                </td>
                                                <td>
                                                    <div class="toolbarIconDivider">|</div>
                                                </td>
                                                <td>
                                                    <asp:LinkButton ID="btnEditSelected"  CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="EditSelected" ><img style="border:0px" alt="" src="../images/edit.gif" /> Edit</asp:LinkButton>
                                                    <asp:LinkButton ID="btnUpdateEdited" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="Update" Visible="false"><img style="border:0px" alt="" src="../images/save.gif" /> Save</asp:LinkButton>
                                                    <asp:LinkButton ID="btnCancel" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="CancelAll"  Visible="false" CausesValidation="false"><img style="border:0px" alt="" src="../images/cancel.gif" /> Cancel</asp:LinkButton>
                                                </td>
                                                <td>
                                                    <div class="toolbarIconDivider">|</div>
                                                </td>
                                                <td>
                                                    <asp:LinkButton ID="btnDelete" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="Delete"  OnClientClick="javascript:return confirm('Are you sure you want to delete this Clinical Pathway Instruction?')" ><img style="border:0px" alt="" src="../images/delete.gif" /> Delete</asp:LinkButton>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </td>
                            </tr>
                        </table>
                     </CommandItemTemplate>                   
                        <DetailTables>
                            <rad:GridTableView  Name="Detail3" DataKeyNames="cpi_id" DataMember="instruction" CommandItemDisplay="Top" EditMode="InPlace" Width="100%">
                            <CommandItemTemplate>
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td style="width:60%">
                                        <div style="padding:3px 4px 3px 4px">
                                            <table border="0" cellpadding="1" cellspacing="1">
                                                <tr style="font: normal 11px tahoma, Verdana, Helvetica, Sans-serif;vertical-align:middle">
                                                    <td>
                                                        <div class="toolbarIconDivider">|</div>
                                                    </td>
                                                    <td>
                                                        <asp:LinkButton ID="btnAdd" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="InitInsert" ><img style="border:0px" alt="" src="../images/addemail.gif" /> Add</asp:LinkButton>
                                                        <asp:LinkButton ID="lnkPerformInsert" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="PerformInsert" Visible="false"><img style="border:0px" alt="" src="../images/save.gif" /> Save</asp:LinkButton>
                                                    </td>
                                                    <td>
                                                        <div class="toolbarIconDivider">|</div>
                                                    </td>
                                                    <td>
                                                        <asp:LinkButton ID="btnEditSelected"  CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="EditSelected" ><img style="border:0px" alt="" src="../images/edit.gif" /> Edit</asp:LinkButton>
                                                        <asp:LinkButton ID="btnUpdateEdited" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="Update" Visible="false"><img style="border:0px" alt="" src="../images/save.gif" /> Save</asp:LinkButton>
                                                        <asp:LinkButton ID="btnCancel" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="CancelAll" Visible="false" CausesValidation="false"><img style="border:0px" alt="" src="../images/cancel.gif" /> Cancel</asp:LinkButton>
                                                    </td>
                                                    <td>
                                                        <div class="toolbarIconDivider">|</div>
                                                    </td>
                                                    <td>
                                                        <asp:LinkButton ID="btnDelete" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="Delete"  OnClientClick="javascript:return confirm('Are you sure you want to delete this Clinical Pathway Instruction?')" ><img style="border:0px" alt="" src="../images/delete.gif" /> Delete</asp:LinkButton>
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                            </CommandItemTemplate>
                             
                            <Columns>
                            <rad:GridBoundColumn DataField="cpi_id" HeaderText="CPI_ID" UniqueName="CPI_ID" Visible="false"></rad:GridBoundColumn>
                            <rad:GridBoundColumn DataField="instructions" HeaderText="instructions" UniqueName="instructions" Visible="false"></rad:GridBoundColumn>
                            <rad:GridTemplateColumn HeaderText="Instructions" UniqueName="instructions" DataField="instructions">
                                <ItemTemplate>
                                    <%# DataBinder.Eval(Container.DataItem, "instructions")%>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="tbIns" runat="server" Text='<%# Bind( "instructions") %>' width="100%" TabIndex="1" TextMode="MultiLine" Rows="4"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="descValidator" Runat="server" Display="Dynamic" ControlToValidate="tbIns" ErrorMessage="* Required Field">
                                </asp:RequiredFieldValidator>
                            </EditItemTemplate>
                            <HeaderStyle Width="90%" />
                            </rad:GridTemplateColumn>
                            <rad:GridTemplateColumn HeaderText="Sort Order" UniqueName="sortorder" DataField="sortorder">
                                <ItemTemplate>
                                    <%# DataBinder.Eval(Container.DataItem, "sortorder")%>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="tbSortOrder" runat="server" Text='<%# Bind( "sortorder") %>' width="30px" TabIndex="2"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="descValidator2" Runat="server" Display="Dynamic" ControlToValidate="tbSortOrder" ErrorMessage="* Required Field">
                                </asp:RequiredFieldValidator>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" Display="Dynamic" ControlToValidate="tbSortOrder" ErrorMessage="Please enter a valid sort order number." ValidationExpression="^\d+$"></asp:RegularExpressionValidator>
                            </EditItemTemplate>
                            </rad:GridTemplateColumn>
                         </Columns>
                            </rad:GridTableView>
                        </DetailTables>
                     
                    <Columns>
                        <rad:GridBoundColumn DataField="cp_id" HeaderText="CP_ID" UniqueName="CP_ID" Visible="false"></rad:GridBoundColumn>
                        <rad:GridBoundColumn DataField="VisitFrequency" HeaderText="VisitFrequency" UniqueName="VisitFrequency" Visible="false"></rad:GridBoundColumn>
                        <rad:GridClientSelectColumn UniqueName="ClientSelectColumnDetail1"></rad:GridClientSelectColumn>
                        <rad:GridTemplateColumn HeaderText="Visit Frequency" UniqueName="VisitFrequency" DataField="VisitFrequency">
                            <ItemTemplate>
                                <%# DataBinder.Eval(Container.DataItem, "VisitFrequency")%>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox ID="tbVisit" runat="server" Text='<%# Bind( "VisitFrequency") %>' width="100%" TabIndex="1" ></asp:TextBox>
                                <asp:RequiredFieldValidator ID="descValidator" Runat="server" Display="Dynamic" ControlToValidate="tbVisit" ErrorMessage="* Required Field">
                            </asp:RequiredFieldValidator>
                        </EditItemTemplate>
                        <HeaderStyle Width="80%" />
                        </rad:GridTemplateColumn>
                        <rad:GridTemplateColumn HeaderText="Sort Order" UniqueName="Sortorder" DataField="Sortorder">
                            <ItemTemplate>
                                <%# DataBinder.Eval(Container.DataItem, "Sortorder")%>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox ID="tbVisitSortOrder" runat="server" Text='<%# Bind( "Sortorder") %>' width="30px" TabIndex="2" Visible="false"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="descValidator2" Runat="server" Display="Dynamic" ControlToValidate="tbVisitSortOrder" ErrorMessage="* Required Field" >
                            </asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" Display="Dynamic" ControlToValidate="tbVisitSortOrder" ErrorMessage="Please enter a valid sort order number." ValidationExpression="^\d+$"></asp:RegularExpressionValidator>
                        </EditItemTemplate>
                        </rad:GridTemplateColumn>               
 
                     </Columns>
                    </rad:GridTableView>
                 </DetailTables>

server side code:

an error will occur "Unable to cast object of type 'Telerik.WebControls.GridCommandItem' to type 'Telerik.WebControls.GridDataItem'." in this line, GridDataItem item = (GridDataItem)e.Item;

protected void MasterGrid_ItemCreated(object sender, GridItemEventArgs e)
        {
            if (e.Item.OwnerTableView.Name == "Detail2" && CommandState == "editselected")
            {
                GridDataItem item = (GridDataItem)e.Item;
                TextBox txtBox = (TextBox)item["Sortorder"].FindControl("tbVisitSortOrder");
                txtBox.Visible = true;
            }
        }


Please help, any response would really be appreciated.

Thanks!
Lyzel
zel
Top achievements
Rank 1
 answered on 24 Sep 2010
16 answers
272 views
I am attempting to update the RadGrid using a Ajax.  I am using a non-Telerik control to trigger the update.    I get the following error.


Script control 'RadGrid1' is not a registered script control. Script controls must be registered using RegisterScriptControl() before calling RegisterScriptDescriptors().
Parameter name: scriptControl

I'm a newbie to Ajax.  Am I missing something beside placing a scriptmanager on the page along with the RadGrid?

Thanks

Iana Tsolova
Telerik team
 answered on 24 Sep 2010
3 answers
164 views
Hi,

I am creating a grid programmatically on the OnInit handler so that my template columns are captured in the ViewState. I am also trying to incorporate 'google-like' filtering, so I need to access the OnColumnCreating handler in the codebehind. However, when I try to add a handler to it, I am told that I cannot do it as OnColumnCreating is protected.
My code is as follows, fairly simple:

    Protected Sub Page_Init(ByVal s As Object, ByVal e As System.EventArgs) Handles Me.Init
  
            Dim rg As New RadGrid
            rg.AutoGenerateColumns = False
            rg.GridLines = GridLines.None
            rg.AllowPaging = True
            rg.AllowSorting = True
            rg.AllowFilteringByColumn = True
            rg.ShowStatusBar = True
            rg.CssClass = "RadGrid"
            rg.Skin = "WebBlue"
            rg.Width = "880"
            rg.GroupingSettings.CaseSensitive = False
  
            AddHandler rg.OnColumnCreating, AddressOf rg_ColumnCreating
  
End Sub

Can anyone help?

Many thanks!
Iana Tsolova
Telerik team
 answered on 24 Sep 2010
7 answers
314 views
Hi,

I have problem with ajax postback. Is possible to cancel ajax postback after refresh grid.

I have grid and I use this code:
function RefreshGrid(search) {
  if (search != "") {
    document.getElementById("search").value = search;
    var masterTable = $find("<%= grdResult.ClientID %>").get_masterTableView();
    masterTable.rebind();
  }
}
 
function requestStart(sender, eventArgs) {
     document.getElementById("ajaxrequest").value = "true";
}
function responseEnd(sender, eventArgs) {
    document.getElementById("ajaxrequest").value = "false";
}

But problem is, that I refresh grid, all page codebehind are called. Not only webservice (use it for reading data).
In PageLoad I use
sAjaxRequest = Request.Params["ajaxrequest"] + "";
if (sAjaxRequest != "true")
{
     //... loading controls and set property from DB (radcombo, radgrid, ...)
}

Grid
<telerik:RadGrid ID="grdResult" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" GridLines="None" onitemdatabound="grdResult_ItemDataBound" PageSize="20" Width="100%" DataSourceID="GridDataSource" BorderStyle="None">
 <PagerStyle Mode="NextPrevAndNumeric" PageButtonCount="10" />
   <ClientSettings AllowDragToGroup="True" EnableRowHoverStyle="true">
   <DataBinding EnableCaching="true" />
   <Selecting AllowRowSelect="true" />
   <ClientEvents /></ClientSettings>
   <HeaderContextMenu enableautoscroll="True"></HeaderContextMenu>
   <MasterTableView>
      <Columns>
         <telerik:GridBoundColumn DataField="Manufacturer" HeaderText="Manufacturer" UniqueName="colManufacturer"></telerik:GridBoundColumn>
         <telerik:GridBoundColumn DataField="Stock" DataFormatString="{0:0}" HeaderStyle-HorizontalAlign="Right" HeaderText="Stock" ItemStyle-HorizontalAlign="Right" UniqueName="Stock"></telerik:GridBoundColumn>
         <telerik:GridBoundColumn DataField="Price" HeaderStyle-HorizontalAlign="Right" HeaderText="Price" ItemStyle-HorizontalAlign="Right" UniqueName="Price"></telerik:GridBoundColumn>
        </Columns>
      </MasterTableView>
</telerik:RadGrid>
<asp:ObjectDataSource ID="GridDataSource" runat="server" SelectMethod="FillResultGrid" TypeName="shop.Service">
  <SelectParameters>
    <asp:FormParameter FormField="search" Name="sSearch" Type="String" />
  </SelectParameters>
</asp:ObjectDataSource>

Problem is, that I don't set combos data and property, then I receive blank controls after ajax.
Ajax framework set my controls, but I don't want it.

Thanks for answer.
Roman Krsko
Iana Tsolova
Telerik team
 answered on 24 Sep 2010
1 answer
370 views
Hi 

I've taken an example from the demo's site, to hide the expand button and add it into an existing column alongside the text.
using this code which is run from RadGrid1_ItemDataBound

public void CreateExpandCollapseButton(GridItem item, string columnUniqueName, String ButtonColumn)
        {
            if (item is GridDataItem)
            {
                if (item.FindControl("MyExpandCollapseButton") == null)
                {
                    Button button = new Button();
                    button.Click += new EventHandler(button_Click);
                    button.CommandName = "ExpandCollapse";
                    button.CssClass = (item.Expanded) ? "rgCollapse" : "rgExpand";
                    button.ID = "MyExpandCollapseButton";
 
                    if (item.OwnerTableView.HierarchyLoadMode == GridChildLoadMode.Client)
                    {
                        string script = String.Format(@"$find(""{0}"")._toggleExpand(this, event); return false;", item.Parent.Parent.ClientID);
 
                        button.OnClientClick = script;
                    }
 
                    int level = item.ItemIndexHierarchical.Split(':').Length;
                    if (level > 1)
                    {
                        button.Style["margin-left"] = level * 5 + "px";
                    }
 
                    TableCell cell = ((GridDataItem)item)[ButtonColumn];
                    cell.Controls.Add(button);
                    cell.Controls.Add(new LiteralControl(" "));
                    cell.Controls.Add(new LiteralControl(((GridDataItem)item).GetDataKeyValue(ButtonColumn).ToString()));
                }
            }
        }

But this code was for the selfHierarchy demo.  I have 6 inner details tables each within each other like so

<telerik:RadGrid ID="RadGrid1" OnPreRender="RadGrid1_PreRender" OnItemDataBound="RadGrid1_ItemDataBound" ShowStatusBar="true" Skin="Office2007" OnItemCreated="RadGrid1_ItemCreated"
            runat="server" AutoGenerateColumns="true" AllowSorting="true" OnDetailTableDataBind="RadGrid1_DetailTableDataBind" OnNeedDataSource="RadGrid1_NeedDataSource" AllowMultiRowSelection="False" OnColumnCreated="RadGrid1_ColumnCreated"
            AllowPaging="false" GridLines="None">
            <MasterTableView DataKeyNames="HierarchyID, Link, Name" AllowMultiColumnSorting="True" AutoGenerateColumns="true" HorizontalAlign="Right">
            <DetailTables>
            <telerik:GridTableView DataKeyNames="HierarchyID, Link, Name" Name="2" Width="100%" runat="server" AutoGenerateColumns="true" HorizontalAlign="Right">
            <ParentTableRelation>
                 <telerik:GridRelationFields DetailKeyField="Link" MasterKeyField="HierarchyID" />
            </ParentTableRelation>
            <DetailTables>
                <telerik:GridTableView DataKeyNames="HierarchyID, Link, Name" Name="3" Width="100%" runat="server" AutoGenerateColumns="true" HorizontalAlign="Right">
                    <ParentTableRelation>
                        <telerik:GridRelationFields DetailKeyField="Link" MasterKeyField="HierarchyID" />
                    </ParentTableRelation>
                    <DetailTables>
                    <telerik:GridTableView DataKeyNames="HierarchyID, Link, Name" Name="4" Width="100%" runat="server" AutoGenerateColumns="true" HorizontalAlign="Right">
                        <ParentTableRelation>
                            <telerik:GridRelationFields DetailKeyField="Link" MasterKeyField="HierarchyID" />
                        </ParentTableRelation>
                        <DetailTables>
                        <telerik:GridTableView DataKeyNames="HierarchyID, Link, Name" Name="5" Width="100%" runat="server" AutoGenerateColumns="true" HorizontalAlign="Right">
                            <ParentTableRelation>
                                <telerik:GridRelationFields DetailKeyField="Link" MasterKeyField="HierarchyID" />
                            </ParentTableRelation>
                            <DetailTables>
                            <telerik:GridTableView DataKeyNames="HierarchyID, Link, Name" Name="6" Width="100%" runat="server" AutoGenerateColumns="true" HorizontalAlign="Right">
                                <ParentTableRelation>
                                    <telerik:GridRelationFields DetailKeyField="Link" MasterKeyField="HierarchyID" />
                                </ParentTableRelation>
                            </telerik:GridTableView>
                            </DetailTables>
                        </telerik:GridTableView>
                        </DetailTables>
                    </telerik:GridTableView>
                    </DetailTables>
                </telerik:GridTableView>
                </DetailTables>
            </telerik:GridTableView>
            </DetailTables>
        </MasterTableView>
        </telerik:RadGrid>

So  i need to know how i can rewrite the CreateExpandCollapseButton for the detailtables and how to hide the default expand column within the details table.
Assuming something like this

            if (e.Column is GridExpandColumn)
            {
                e.Column.Visible = false;
            }

Thanks for any assistance.

Matt
Pavlina
Telerik team
 answered on 24 Sep 2010
1 answer
98 views
hi
i work with 1,000,000 records of data!
how can i use RadGrid with sql2005 paging? (that every page = 1000 rows)
with paging , sorting , grouping and export current page to excel...
please help me!
really thanks :)
Tsvetina
Telerik team
 answered on 24 Sep 2010
1 answer
86 views
Dear Telerik Team,

We were evaluating telerik ajax for one our major project.

We want a feature such as Maintaining the state of some additional Key-Value collection for the whole life cycle of the Ajax Panel or AjaxManager.

We are in a requirement of loading UserControls dynamically in the page where as we will be in requirement of storing the values from the UserControl some where which should not be in ViewState or should not be burden for page loading (performance on loading the page).

And also we should be able to read this key-value collection from the client side & server side.

Is there any supporting feature available in the Telerik Ajax. Please guide in this regard.

Thanks,

Suneetha.
Maria Ilieva
Telerik team
 answered on 24 Sep 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?