Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
113 views
Hi,
 how to change the text of a boundcolumn when that row is selected?
Princy
Top achievements
Rank 2
 answered on 17 Apr 2014
3 answers
753 views
We using the datepicker with input format "dd-mm-yyyy" in our asp.net web application. Created an validator function for this format. Works fine when leaving the input field it checks the format "dd-mm-yyyy" but when we want to save the record our validator function gets the date as "yyyy-mm-dd" which is invalid according to our validator function. What to do.
Shinu
Top achievements
Rank 2
 answered on 17 Apr 2014
6 answers
885 views

Hi Telerik Team,

     i'm using ASP>NET AJAX RadAutoCompleteBox. I set the DatasourceId its working fine. I can go through the filtered items with "UP" and "Down" keys, but I want to select an item with "TAB" and "ENTER" Key. When I hit TAB or ENTER on dropdown item it should select that item and the OnTextChanged Event should fire.
     I checked the Demo there its selecting when I hit TAB & Enter. But on my screen its not working. Is I missed or messed something.

My code for your reference.

Thanks,


<telerik:RadAutoCompleteBox ID="txtPolicyNo" runat="server" Width="100px" DropDownWidth="98px" DropDownHeight="200px"       DataSourceID="edsPolicy" DataTextField="PolicyNumber" Filter="StartsWith" InputType="Text"   OnTextChanged="txtPolicyNo_TextChanged" TextSettings-SelectionMode="Single">
          <TokensSettings AllowTokenEditing="true" />
</telerik:RadAutoCompleteBox>
                              
 <asp:EntityDataSource ID="edsPolicy" runat="server" ConnectionString="name=PSSContainer" DefaultContainerName="PSSContainer"
           EnableFlattening="false" EntitySetName="tblPolicies" OrderBy="it.[PolicyNumber]" Select="it.[PolicyNumber]"
           GroupBy="it.[PolicyNumber]"
           Where="it.Chapter = @ChapterCode and it.IsPolicy = @IsPolicyOrProcedure">
           <WhereParameters>
                      <asp:ControlParameter ControlID="ddlChapter" DbType="String"
                           DefaultValue="" Name="ChapterCode" PropertyName="Text" />
                       <asp:ControlParameter ControlID="hfServiceType" DbType="Boolean"
                           DefaultValue="" Name="IsPolicyOrProcedure" PropertyName="Value" />
            </WhereParameters>
 </asp:EntityDataSource>



protected void txtPolicyNo_TextChanged(object sender, Telerik.Web.UI.AutoCompleteTextEventArgs e)
{
     try
         {
               string PolicyNo = txtPolicyNo.Text;

                if (PolicyNo.Length > 0)
                {
                    //PolicyNo = PolicyNo.Substring(0, PolicyNo.Length - 2);
                    PolicyNo = PolicyNo.Replace("; ", "");
'
'
'
'
                }
                 
          }
          catch (Exception ex)
          {
               
          }
}
Plamen
Telerik team
 answered on 17 Apr 2014
1 answer
168 views
hi
i have grid in batch mode.i add row addNewRecord in java script now after added i want select this by java script code but inserteditem is null
how can select this row by java script code?
Konstantin Dikov
Telerik team
 answered on 17 Apr 2014
14 answers
301 views
Want to sort my group by week number based on the date field.
Trying to convert my old grid (attached old_grid.gif) to Telerik: RadGrid (attached telrik_grid.gif) but the grouping gets sorted recipe from 1-52. I want to get the grouping based on the date field, in this case, week 8 (see attached old_grid.gif)

Attached old_grid.gif is correct grouped........

The asp:SqlDataSource:
SelectCommand="select * from dogtraining where fidnr = @fidnr Order By datum DESC"

The GroupByExpressions:​
<GroupByExpressions>
    <telerik:GridGroupByExpression>
        <SelectFields>
            <telerik:GridGroupByField FieldName="weeknumber" FieldAlias="Vecka" />
        </SelectFields>
        <GroupByFields>
            <telerik:GridGroupByField FieldName="weeknumber" />
        </GroupByFields>
    </telerik:GridGroupByExpression>
</GroupByExpressions>
Radoslav
Telerik team
 answered on 17 Apr 2014
3 answers
243 views
Why is it that when I use a RadGrid that my bound column formatting is inconsistent with the GridColumnEditor columns?

Regards
Princy
Top achievements
Rank 2
 answered on 17 Apr 2014
3 answers
173 views
Hi,

I am trying to figure out how to rebind and update only:
RadListView, which exists in a RadGrid nestedviewtemplate, which is again in another RadGrid's nestedviewtemplate

Steps:

I am calling a RadWindow when user clicks on a button, which exists in RadListView itemtemplate
After adding a record, radwindow should close and rebind and update only that RadListView, which called the RadWindow.

Simple example format with out columns and datasources:

<telerik:RadGrid ID="RadGrid1" runat="server">
            <MasterTableView>
                <NestedViewTemplate>
                    <telerik:RadGrid ID="RadGrid2" runat="server">
                        <MasterTableView>
                            <NestedViewTemplate>
                                <telerik:RadListView ID="RadListView1" runat="server">
                                    <ItemTemplate>
                                        <asp:Button ID="Button1" runat="server" Text="Button" />
                                    </ItemTemplate>
                                </telerik:RadListView>
                            </NestedViewTemplate>
                        </MasterTableView>
                    </telerik:RadGrid>
                </NestedViewTemplate>
            </MasterTableView>
        </telerik:RadGrid>


I will be really thankful if anyone can help.
Shinu
Top achievements
Rank 2
 answered on 17 Apr 2014
5 answers
337 views
I am having trouble horizontally centering the text under the barcode. See the attached image. Thanks!
Mariah
Top achievements
Rank 1
 answered on 17 Apr 2014
5 answers
246 views
Hi,

Normally you can't select a listboxitem that is set Enabled="false". But when selectmode="Multiple" and using shift keybord key, you can still select a disabled item.:
<telerik:RadListBox ID="rlb" runat="server" SelectionMode="Multiple">
            <Items>
                <telerik:RadListBoxItem Text="aaa" />
                <telerik:RadListBoxItem Text="bbb" Enabled="false" />
                <telerik:RadListBoxItem Text="ccc" />
            </Items>
        </telerik:RadListBox>
To select item "bbb":
Select the first item. Hold down shift key. Select the last item.
"bbb" gets selected. This should not be possible, right?

Regards
Caesar

Shinu
Top achievements
Rank 2
 answered on 17 Apr 2014
3 answers
217 views
Hi All,

I try to make unlimited hierarchical radgrid with SelfHierarchySettings. But when i try to expand a node i can not see the child level inside "No child records to display."  I don't want to use  HierarchyLoadMode ="Client"  so can any body check and inform me what's the problem with my code

Regards ..

<body> 
    <form id="form1" runat="server">  
    <asp:ScriptManager ID="sm" runat="server" /> 
    <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" OnColumnCreated="RadGrid1_ColumnCreated" 
        OnItemCreated="RadGrid1_ItemCreated" OnItemDataBound="RadGrid1_ItemDataBound" 
        OnDetailTableDataBind="RadGrid1_DetailTableDataBind">  
        <MasterTableView AllowSorting="true" DataKeyNames="FullPath,ParentPath,IsFolder" 
            Width="100%" > 
            <SelfHierarchySettings ParentKeyName="FullPath" KeyName="ParentPath" /> 
        </MasterTableView> 
        <ClientSettings AllowExpandCollapse="true" /> 
    </telerik:RadGrid> 
    </form> 
</body> 

 

public partial class test2 : System.Web.UI.Page  
{  
    protected void Page_Load(object sender, EventArgs e)  
    {  
        if (!Page.IsPostBack)  
        {  
            GridBoundColumn col = new GridBoundColumn();  
            col.HeaderText = "FullPath";  
            col.DataField = "FullPath";  
            RadGrid1.Columns.Add(col);  
 
            col = new GridBoundColumn();  
            col.HeaderText = "ParentPath";  
            col.DataField = "ParentPath";  
            RadGrid1.Columns.Add(col);  
            RadGrid1.DataSource = GetData("/");  
 
        }  
    }  
 
    private DataTable GetData(string ParentPath)  
    {  
        DataTable dt = new DataTable();  
        dt.Columns.Add(new DataColumn("FullPath"));  
        dt.Columns.Add(new DataColumn("ParentPath"));  
        dt.Columns.Add(new DataColumn("IsFolder"typeof(bool)));  
        DataRow dr;  
        for (int i = 0; i < 3; i++)  
        {  
            dr = dt.NewRow();  
            dr[0] = ParentPath + "Folder" + i;  
            dr[1] = ParentPath;  
            dr[2] = true;  
            dt.Rows.Add(dr);  
        }  
 
        for (int i = 0; i < 2; i++)  
        {  
            dr = dt.NewRow();  
            dr[0] = ParentPath + "File" + i.ToString() + ".txt";  
            dr[1] = ParentPath;  
            dr[2] = false;  
            dt.Rows.Add(dr);  
        }  
 
        return dt;  
    }  
 
    protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e)  
    {  
        if (e.Column is GridExpandColumn)  
        {  
            e.Column.Visible = false;  
        }  
        else if (e.Column is GridBoundColumn)  
        {  
            e.Column.HeaderStyle.Width = Unit.Pixel(100);  
        }  
    }  
 
    public void Page_PreRenderComplete(object sender, EventArgs e)  
    {  
        HideExpandColumnRecursive(RadGrid1.MasterTableView);  
    }  
 
    public void HideExpandColumnRecursive(GridTableView tableView)  
    {  
        GridItem[] nestedViewItems = tableView.GetItems(GridItemType.NestedView);  
        foreach (GridNestedViewItem nestedViewItem in nestedViewItems)  
        {  
            foreach (GridTableView nestedView in nestedViewItem.NestedTableViews)  
            {  
                nestedView.Style["border"] = "0";  
 
                Button MyExpandCollapseButton = (Button)nestedView.ParentItem.FindControl("MyExpandCollapseButton");  
                if (nestedView.ParentItem.GetDataKeyValue("IsFolder").ToString() == "False")  
                {  
                    if (MyExpandCollapseButton != null)  
                    {  
                        MyExpandCollapseButton.Style["visibility"] = "hidden";  
                    }  
                    nestedViewItem.Visible = false;  
                }  
                else 
                {  
                    if (MyExpandCollapseButton != null)  
                    {  
                        MyExpandCollapseButton.Style.Remove("visibility");  
                    }  
                }  
 
                if (nestedView.HasDetailTables)  
                {  
                    HideExpandColumnRecursive(nestedView);  
                }  
            }  
        }  
    }  
 
    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)  
    {  
        CreateExpandCollapseButton(e.Item, "FullPath");  
 
        if (e.Item is GridHeaderItem && e.Item.OwnerTableView != RadGrid1.MasterTableView)  
        {  
            e.Item.Style["display"] = "none";  
        }  
 
        if (e.Item is GridNestedViewItem)  
        {  
            e.Item.Cells[0].Visible = false;  
        }  
    }  
 
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)  
    {  
        CreateExpandCollapseButton(e.Item, "FullPath");  
    }  
 
    public void CreateExpandCollapseButton(GridItem item, string columnUniqueName)  
    {  
        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 + 10 + "px";  
 
 
                TableCell cell = ((GridDataItem)item)[columnUniqueName];  
                cell.Controls.Add(button);  
                cell.Controls.Add(new LiteralControl("&nbsp;"));  
                cell.Controls.Add(new LiteralControl(((GridDataItem)item).GetDataKeyValue(columnUniqueName).ToString()));  
            }  
        }  
    }  
 
    void button_Click(object sender, EventArgs e)  
    {  
        ((Button)sender).CssClass = (((Button)sender).CssClass == "rgExpand") ? "rgCollapse" : "rgExpand";  
    }  
 
    protected void RadGrid1_DetailTableDataBind(Object source, GridDetailTableDataBindEventArgs e)  
    {  
        GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem;  
        if (dataItem.GetDataKeyValue("IsFolder").ToString() == "True")  
        {  
            e.DetailTableView.DataSource = GetData(dataItem.GetDataKeyValue("FullPath").ToString());  
        }  
    }  
}  
 
Pavlina
Telerik team
 answered on 16 Apr 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?