Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
171 views
Im trying to open radwindow on radgrid image button click event. It woks fine when one user is trying to save data on radwindow. But issue is when there are multiple users on the application and on same page and trying to enter their data on radwindow its not saving data correctly.


Can some one help me on this issue.
Marin Bratanov
Telerik team
 answered on 29 Oct 2014
3 answers
72 views
I have some radcontrols as RadTextBox, RadComboBox, RadDatePicker.

I want them stay one line but i can't.

They display perfect on Chrome but IE is not.

pictures below :
Viktor Tachev
Telerik team
 answered on 29 Oct 2014
3 answers
97 views
I'm using a radgrid with InPlace edit.  I added the following settings to freeze column headers.
ClientSettings-Scrolling-AllowScroll="true"
ClientSettings-Scrolling-UseStaticHeaders="true"

The dynamically generated command buttons are being chopped off as shown.  I haven't been able to resolve.

Any help would be appreciated.

Pete
Top achievements
Rank 1
 answered on 29 Oct 2014
1 answer
92 views
Hi,

I'm using code snippet as follows:
Title = string.Format("<a class=\"LeadStory\" href=\"/Report/{0}/{1}\"><h1>{2}</h1></a>",
                            ds.Tables[0].Rows[0]["report_id"].ToString(),
                            aaHelper.Text.StripText.UrlTitle(ds.Tables[0].Rows[0]["title"].ToString()),
                            ds.Tables[0].Rows[0]["title"].ToString());
 
                    ReadMore = string.Format("<a class=\"LeadFullReport\" href=\"Report/{0}/{1}\">full report</a>",
                        ds.Tables[0].Rows[0]["report_id"].ToString(),
                        aaHelper.Text.StripText.UrlTitle(ds.Tables[0].Rows[0]["title"].ToString()));
RadEditor1.Snippets.Add("Lead Title", Title);
                    RadEditor1.Snippets.Add("Full Report", ReadMore);
When I insert both code snippets, the "Full Report" works correctly, but the problem is with the "Title", where the editor generate it like: <a....></a><h1>....</h1>
Even when I manually change the code in HTML view then switch back to design view, the editor change the code again.

I'm using version 2014.2.724.45

Any idea?
Ianko
Telerik team
 answered on 29 Oct 2014
1 answer
151 views
I thought I'd share this method I use to access the data from a selected row through Javascript.

I have, on many occasions, a need to access the information in a selected row from Javascript on a RadGrid row selected, through the use of the following property in the RadGrid declaration:
    <ClientEvents OnRowSelected="OnRowSelected" />

Traditionally, I have used the standard way of accessing the data one element at a time: 
function OnRowSelected(sender, eventArgs) {
    var MasterTable = sender.get_masterTableView();
    var row = MasterTable.get_dataItems()[eventArgs.get_itemIndexHierarchical()];
    var someVar= MasterTable.getCellByColumnUniqueName(row, 'someColumnName').innerHTML;

In my usual use, I will need to access many, if not all, of the value from that selected row.  This would require a variable declaration for each column's data, which isn't that bad when you are only dealing with a handful of columns but can become a chore when there are many columns.  I had a RadGrid that had 20+ columns with the need to access every one of the columns to dynamically populate certain html elements on the row click (all client-side), requiring quite a bit of JS code. 

All this led to me coming up with this method of collecting all the columns of the selected row in an easy-to-use javascript object:
function OnRowSelected(sender, eventArgs) {
    var mt = sender.get_masterTableView();
    var row = mt.get_dataItems()[eventArgs.get_itemIndexHierarchical()];
    var mtCol = mt.get_columns();
    var grdCols = {};
    for (var i = 0; i < mtCol.length; i++) { grdCols[mtCol[i].get_uniqueName()] = ''; }
    for (var k in grdCols) { grdCols[k] = mt.getCellByColumnUniqueName(row, k).innerHTML; }
    alert(grdCols.someColumnUniqueName);
      ...

This declares an empty object, populates a key:value pair of the column unique name and an empty string, and then loops through object and sets the value for each key based on the key name set in the previous step.  To access the data, use the object name (grdCols) and the ColumnUniqueName.  

These generic lines of code can be placed into anywhere a particular row's values are needed.  

Hopefully this can help someone looking for a similar solution.
Konstantin Dikov
Telerik team
 answered on 29 Oct 2014
3 answers
319 views
Hi,

I have a radcombobox who have some item with the same text(ex: Item1, Item1), but both has a different value. But when i want to get the selectedValue of the second one, it always return me the first item value.

Is the a way to return the good value even if there two or more item that has the same text.

Thx for your help,

Guillaume
Nencho
Telerik team
 answered on 29 Oct 2014
12 answers
302 views
i have a rad grid that has some rad combos in to filter data

<telerik:RadGrid ID="RadGridProducts" AllowSorting="True"
            AllowFilteringByColumn="true"
            DataSourceID="ObjDSProducts"
            AutoGenerateColumns="false"
            ShowStatusBar="true"
            CommandItemDisplay="Top"
            AllowAutomaticDeletes="True"
            AllowAutomaticInserts="True"      
            AllowPaging="True" PageSize="10" runat="server" GridLines="None" Width="100%"
            EnableLinqExpressions="false">             
                    
            <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
             
            <MasterTableView DataKeyNames="Product_ID" AlternatingItemStyle-VerticalAlign="Top" ItemStyle-VerticalAlign="Top"  CommandItemDisplay="Top">
                <CommandItemSettings AddNewRecordImageUrl="~/connexassets/images/space.gif" AddNewRecordText="" ShowExportToExcelButton="true" />     
                <Columns>                   
                    <telerik:GridTemplateColumn DataField="Image" HeaderText="Image" AllowFiltering="false" UniqueName="Image" HeaderStyle-Width="45px" SortExpression="Group_Name">
                        <ItemTemplate><asp:Image runat="server" ID="PrdImg" ImageUrl='<%# String.Format("productresize.aspx?filename={0}&width=55", Eval("Image").ToString()) %>' Width="45px" BorderWidth="0" /></ItemTemplate>
                    </telerik:GridTemplateColumn>    
                    <telerik:GridBoundColumn UniqueName="Product_Code"  DataField="Code"  HeaderText="Code" AllowFiltering="false" HeaderStyle-Width="75px" />                       
                    <telerik:GridTemplateColumn AllowFiltering="true" DataField="Product_Title" HeaderText="Title" UniqueName="Product_Title" HeaderStyle-Width="225px" SortExpression="Product_Title">
                        <FilterTemplate>
                            <telerik:RadComboBox ID="RadComboBoxTitle" DataSourceID="SqlTitleDS" DataTextField="Product_Title"
                                DataValueField="Product_Title" Height="200px" DropDownWidth="390px" Filter="StartsWith" Width="220px" AppendDataBoundItems="true" SelectedValue='<%# TryCast(Container,GridItem).OwnerTableView.GetColumn("Product_Title").CurrentFilterValue %>'
                                runat="server" OnClientSelectedIndexChanged="Product_TitleIndexChanged">
                                <Items>
                                    <telerik:RadComboBoxItem Text="All" />
                                </Items>
                            </telerik:RadComboBox>
                            <telerik:RadScriptBlock ID="RadScriptBlockTitle" runat="server">
 
                                <script type="text/javascript">
                                    function Product_TitleIndexChanged(sender, args) {
                                        var tableView = $find("<%# TryCast(Container,GridItem).OwnerTableView.ClientID %>");
                                        tableView.filter("Product_Title", args.get_item().get_value(), "EqualTo");
                                    }
                                </script>
 
                            </telerik:RadScriptBlock>
                        </FilterTemplate>
                        <ItemTemplate>
                            <%#Eval("Product_Title")%>
                            <br /><asp:Label ID="lblProduct" Font-Bold="true" Font-Size="Smaller" Visible="true" runat="server" Text=""></asp:Label>                       
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>                   
                    <telerik:GridBoundColumn DataField="Product_Details"
                        HeaderText="Details"
                        SortExpression="Product_Details" UniqueName="Product_Details" Visible="false">
                    </telerik:GridBoundColumn>                                       
                    <telerik:GridTemplateColumn UniqueName="Product_Price" DataField="Product_Price" HeaderText="Price" AllowFiltering="false" HeaderStyle-Width="60px">
                        <ItemTemplate>
                            <asp:Label ID="lblShowWeb" Visible="true" runat="server" Text="" />
                        </ItemTemplate>
                    </telerik:GridTemplateColumn
                    <telerik:GridTemplateColumn AllowFiltering="true" DataField="Brand_Title" HeaderText="Brand" UniqueName="Brand_Title" HeaderStyle-Width="80px" SortExpression="Brand_Title">
                        <FilterTemplate>
                            <telerik:RadComboBox ID="RadComboBoxBrand" DataSourceID="SqlBrandDS" DataTextField="Brand_Title"
                                DataValueField="Brand_Title" Height="200px" DropDownWidth="215px" Width="165px" AppendDataBoundItems="true" SelectedValue='<%# TryCast(Container,GridItem).OwnerTableView.GetColumn("Brand_Title").CurrentFilterValue %>'
                                runat="server" OnClientSelectedIndexChanged="Brand_NameIndexChanged">
                                <Items>
                                    <telerik:RadComboBoxItem Text="All" />
                                </Items>
                            </telerik:RadComboBox>
                            <telerik:RadScriptBlock ID="RadScriptBlockBrand" runat="server">
 
                                <script type="text/javascript">
                                    function Brand_NameIndexChanged(sender, args) {
                                        var tableView = $find("<%# TryCast(Container,GridItem).OwnerTableView.ClientID %>");
                                        tableView.filter("Brand_Title", args.get_item().get_value(), "EqualTo");
                                    }
                                </script>
 
                            </telerik:RadScriptBlock>
                        </FilterTemplate>
                        <ItemTemplate><%#Eval("Brand_Title")%></ItemTemplate>
                    </telerik:GridTemplateColumn>                   
                    <telerik:GridTemplateColumn UniqueName="ProductEditOptions" HeaderText="" HeaderStyle-Width="65px" AllowFiltering="false">
                        <ItemTemplate>
                            <asp:ImageButton ID="imgButEdit" runat="server" CausesValidation="true" AlternateText="Edit Product" CommandArgument='<%# Bind("Product_ID") %>' CommandName="Edit" ImageUrl="~/ConnexAssets/images/view.gif" />
                            <asp:ImageButton ID="imgbutdele" CommandArgument='<%# Bind("Product_ID") %>' runat="server" ImageUrl="~/ConnexAssets/images/delete.gif" OnClientClick="javascript:return confirm('Are you sure you want to permanently delete this product?');" CommandName="DeleteProduct" />                       
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>                                      
                </Columns>
                <DetailTables>
                    <telerik:GridTableView DataKeyNames="Prod_ID, Rel_ID" DataSourceID="DSRelated" Width="100%" runat="server" CommandItemSettings-AddNewRecordText="Add Related Product" CommandItemDisplay="Top" ShowHeader="false" AllowFilteringByColumn="false" Name="Child">
                        <NoRecordsTemplate>No Related Products listed....</NoRecordsTemplate>
                        <ParentTableRelation>
                            <telerik:GridRelationFields DetailKeyField="Prod_ID" MasterKeyField="Product_ID" />
                        </ParentTableRelation>
                        <AlternatingItemStyle BackColor="AliceBlue" />
                        <Columns>
                            <telerik:GridBoundColumn SortExpression="RelatedProdName" ReadOnly="true" HeaderText="Related Product" Visible="true"  HeaderButtonType="TextButton" DataField="RelatedProdName" UniqueName="RelatedProdName" />
                            <telerik:GridButtonColumn ConfirmText="Delete this Related Product?" ButtonType="ImageButton" CommandName="Delete" Text="Delete" UniqueName="DeleteColumn2">
                                <HeaderStyle Width="20px" />
                                <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
                            </telerik:GridButtonColumn>
                        </Columns>
                        <SortExpressions>
                            <telerik:GridSortExpression FieldName="RelatedProdName" SortOrder="Descending"></telerik:GridSortExpression>
                        </SortExpressions>
                        <EditFormSettings EditFormType="Template">               
                            <FormTemplate>
                                <table id="Table2" cellspacing="2" cellpadding="1" width="100%" border="0" rules="none" style="border-collapse: collapse; background: white;">
                                    <tr>
                                        <td>
                                            <table id="Table3" cellspacing="1" cellpadding="1" border="0">
                                                <tr><td colspan="2"></td></tr>
                                                <tr>
                                                    <td valign="top">Product:</td>
                                                    <td>
                                                    <asp:DropDownList ID="RelProd_ID" runat="server" Width="586px"
                                                        DataSourceID="SqlDataSourceStock"
                                                        DataTextField="Product_Title" SelectedValue='<%# Bind("RelProd_ID") %>'
                                                        DataValueField="RelProd_ID" TabIndex="1" AppendDataBoundItems="True">
                                                        <asp:ListItem Selected="True" Text=" Select the product you wish to select as a related product " Value=""></asp:ListItem>
                                                    </asp:DropDownList>
                                                       </td>
                                                </tr>
                                                <tr><td colspan="2"></td></tr>                                              
                                            </table>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right">
                                            <asp:Button ID="btnUpdate" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>'
                                                runat="server" CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>'>
                                            </asp:Button
                                            <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel"></asp:Button>
                                        </td>
                                    </tr>
                                </table>
                            </FormTemplate>
                        </EditFormSettings>
                    </telerik:GridTableView>                   
                </DetailTables>
            </MasterTableView>           
             
        </telerik:RadGrid>

But fo you filter the product by title and then delete the product, if i try a rebind on the grid it fails as the selected value of the combo in the filter template no longer exists so it errors as follows:

System.ArgumentOutOfRangeException: Selection out of range Parameter name: value

Generated: Tue, 30 Aug 2011 11:29:16 GMT

System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.ArgumentOutOfRangeException: Selection out of range

Parameter name: value

   at Telerik.Web.UI.RadComboBox.PerformDataBinding(IEnumerable dataSource)

   at Telerik.Web.UI.RadComboBox.OnDataSourceViewSelectCallback(IEnumerable data)

   at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)

   at Telerik.Web.UI.RadComboBox.OnDataBinding(EventArgs e)

   at Telerik.Web.UI.RadComboBox.PerformSelect()

   at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()

   at System.Web.UI.Control.DataBindChildren()

   at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)

   at System.Web.UI.Control.DataBind()

   at System.Web.UI.Control.DataBindChildren()

   at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)

   at System.Web.UI.Control.DataBind()

   at Telerik.Web.UI.GridItem.SetupItem(Boolean dataBind, Object dataItem, GridColumn[] columns, ControlCollection rows)

   at Telerik.Web.UI.GridTableView.CreateFilteringItem(Boolean useDataSource, GridColumn[] copiedColumnSet, GridTHead thead)

   at Telerik.Web.UI.GridTableView.CreateControlHierarchy(Boolean useDataSource)

   at Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource)

   at System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data)

   at System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data)

   at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)

   at System.Web.UI.WebControls.DataBoundControl.PerformSelect()

   at Telerik.Web.UI.GridTableView.PerformSelect()

   at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()

   at Telerik.Web.UI.GridTableView.DataBind()

   at Telerik.Web.UI.RadGrid.DataBind()

   at connex_site_products.RadGridProducts_ItemCommand(Object source, GridCommandEventArgs e) in G:\T4\connex\site_products.aspx.vb:line 56

   at Telerik.Web.UI.RadGrid.OnItemCommand(GridCommandEventArgs e)

   at Telerik.Web.UI.RadGrid.OnBubbleEvent(Object source, EventArgs e)

   at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)

   at Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e)

   at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)

   at System.Web.UI.WebControls.ImageButton.OnCommand(CommandEventArgs e)

   at System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument)

   at System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)

   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)

   at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)

   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

   --- End of inner exception stack trace ---

   at System.Web.UI.Page.HandleError(Exception e)

   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

   at System.Web.UI.Page.ProcessRequest()

   at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)

   at System.Web.UI.Page.ProcessRequest(HttpContext context)

   at ASP.connex_site_products_aspx.ProcessRequest(HttpContext context)

   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()

   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)


Heres my code behind page:

Protected Sub RadGridProducts_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGridProducts.ItemCommand
        Select Case e.CommandName
            Case "DeleteProduct"
                ProductItems.Delete(e.CommandArgument)
                RadGridProducts.MasterTableView.DataBind()
            Case Telerik.Web.UI.RadGrid.ExportToExcelCommandName
                ConfigureExport()
                RadGridProducts.MasterTableView.ExportToExcel()
            Case "Edit"
                Response.Redirect("site_editproduct.aspx?id=" & e.CommandArgument & "&page=" & RadGridProducts.CurrentPageIndex & "&filter=" & RadGridProducts.MasterTableView.FilterExpression.ToString)
        End Select
    End Sub


Any ideas?







Eyup
Telerik team
 answered on 29 Oct 2014
10 answers
945 views


Hi all,

I  created a control in codebehind,and assigned a id in server side , I need to do with it in client side now ,the following is js function.I call this function in codebehind,id is a parameter,I need to find id of client side。
 
 function cbxSelectChange(id)
    {        
    var cbxId = $find("<%= id.ClientID %>"); ---  id is a parameter
    
    }



Any help on this will be grateful. 
Nencho
Telerik team
 answered on 29 Oct 2014
1 answer
116 views
How do I set up a gauge from -100 to 100 where 0 is on the top of the gauge?

All attempts to put a navigate value in the scale.min have produced a gauge that still starts at zero.
Brad
Danail Vasilev
Telerik team
 answered on 29 Oct 2014
1 answer
97 views
I'm looking for the simplest way to show multiple values from the selected item inside of the input area for a combobox. So for instance if I'm binding my combobox to a list of Person objects, that each have FirstName and LastName string properties, then I'd like to display the full name (the composite of both properties) of the selected person in the input area.

One way I see to do this is to create a property called FullName on the Person class that returns the composite string of the FirstName and LastName properties. And then set DataTextField on the combo box to use FullName to populate the input field.

Are there any other ways to accomplish this? Is it possible to create a template for the input area content or some other way to set the input value other than using DataTextField?

Thanks in advance!
Peter Filipov
Telerik team
 answered on 29 Oct 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?