Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
144 views

I have an edit page that is able to edit administrators of a site, on reload or edit of the admin I need to load the name in the autocomplete box and then disable so they cannot change it on edit.  Problem is I can seem to figure out how to reload the autocompletebox with the text.

 

myDataTable = New DataTable
        myDataTable = getReader(sql)
 
        If myDataTable.Rows.Count > 0 Then
            HFAdminId.Value = myDataTable.Rows(0)(0)
            txtItemSearch.Text = myDataTable.Rows(0)(0).ToString()
            ddlLocations.SelectedValue = myDataTable.Rows(0)(2)
       End If
 
Also tried this but to no avail.
 
   myDataTable = New DataTable
        myDataTable = getReader(sql)
 
        If myDataTable.Rows.Count > 0 Then
            HFAdminId.Value = myDataTable.Rows(0)(0)
            txtItemSearch.Entries(0).Text = myDataTable.Rows(0)(1).ToString
            ddlLocations.SelectedValue = myDataTable.Rows(0)(2)
         end if
 
Both gave me this error
 
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
 
 Exception Details: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
 
Source Error:

Bozhidar
Telerik team
 answered on 07 Jul 2015
1 answer
306 views

I am trying to check to see if the autocomplete box has no value before I go on in code, but the 2 methods I tried do not seem to work. I have it in single mode selection and getting the value fine but when checking for it, the code always escapes to else statement.

 

If txtItemSearch.Entries(0).Value = String.Empty Then
           ScriptManager.RegisterClientScriptBlock(Page, GetType(Page), "OpenWindow", "alert('You must specify an administrator.');", True)
       Else
           Dim adminId As Integer = Convert.ToInt32(txtItemSearch.Entries(0).Value)
           Dim locationId As String = ddlLocations.SelectedValue
           'Dim siteAdmin As Integer = boolToInt(chkSiteAdmin.Checked)
           'Dim contact As Integer = boolToInt(chkContact.Checked)
           'Dim email As Integer = boolToInt(chkEmail.Checked)
 
 
If txtItemSearch.Entries.count < 0 Then
           ScriptManager.RegisterClientScriptBlock(Page, GetType(Page), "OpenWindow", "alert('You must specify an administrator.');", True)
       Else
           Dim adminId As Integer = Convert.ToInt32(txtItemSearch.Entries(0).Value)
           Dim locationId As String = ddlLocations.SelectedValue
           'Dim siteAdmin As Integer = boolToInt(chkSiteAdmin.Checked)
           'Dim contact As Integer = boolToInt(chkContact.Checked)
           'Dim email As Integer = boolToInt(chkEmail.Checked)
 
 
<div class="div100">
           <telerik:RadAutoCompleteBox ID="txtItemSearch" runat="server" Width="260px" OnClientRequesting="requesting" AllowCustomEntry="false" DropDownPosition="Automatic" CssClass="centAutocomplete"
                   EmptyMessage="Enter Last Name First Name to Search"  InputType="Text"  HighlightFirstMatch="true" TextSettings-SelectionMode="Single" DropDownWidth="250px">
                   <WebServiceSettings path="../AutoComplete.asmx" Method="FindAdmin" />
           </telerik:RadAutoCompleteBox>
           <asp:HiddenField ID="HFAdminId" runat="server" />
       </div>

 

Bozhidar
Telerik team
 answered on 07 Jul 2015
1 answer
71 views
How would can you use IsSeparater="True" with databound menu items?  what needs be stored in the database table?
Hristo Valyavicharski
Telerik team
 answered on 07 Jul 2015
4 answers
253 views


I want to know how to implement custom filter in RadGrid.

I have a Ajaxfied RadGrid and datasource is binded in NeedDatasource event. The RadGrid has five columns..

In that, I want to change the filter of one of the column to selectable filter..

So, I added a FilterTemplate and added the RadComboBox inside to it..

Initially, I hardcoded all the RadComboBox item in the design time itself.. Binded a javascript to clientside_selectedchanged event.. This approach worked fine..

When I binded RadComboBox with collection (List) in the code behind.. The filtering didn't work.. I binded the RadComboBox in GridItemDataBound or GridItemCreated event.. But no luck..

Any help.. will be very much useful to me.. I spent nearly two days but I didn't any direction... I'm nearing to my deadline.. so I have no other option left out other than this forum..

Custom Filter Code

The following is sample code which I copied from my project and pasted here.. I have changed the field names alone..

Filter Template:

<telerik:GridBoundColumn DataField="DepartmentDescription" Groupable="true" HeaderText="Program" UniqueName="DepartmentDescription">

    <FilterTemplate>

        <telerik:RadComboBox ID="RadComboBoxDepartmentDescription" runat="server"

            AppendDataBoundItems="true"

            DataTextField="DepartDesc"

            DataValueField=" DepartDesc "

            OnClientSelectedIndexChanged="RadComboBoxDepartmentDescriptionIndexChanged"

            OnDataBound="RadComboBoxAllFilters_OnDataBound"

            SelectedValue='<%#TryCast(Container,GridItem).OwnerTableView.GetColumn("DepartmentDescription ").CurrentFilterValue%>'

            Width="100px">

            <Items>

                <telerik:RadComboBoxItem Text="All" Value="" />

            </Items>

        </telerik:RadComboBox>

        <telerik:RadScriptBlock ID="RadScriptBlockProgram" runat="server">

            <script type="text/javascript">



                function RadComboBoxDepartmentDescriptionIndexChanged(sender, args) {

                    var tableView = $find("<%# TryCast(Container,GridItem).OwnerTableView.ClientID%>");

                    tableView.filter("DepartmentDescription", args.get_item().get_value(), "EqualTo");

                }

            </script> 

        </telerik:RadScriptBlock>

    </FilterTemplate>

    <ItemStyle Wrap="False" />

    <HeaderStyle Wrap="false" />

</telerik:GridBoundColumn>





RadGrid DataBinding Code

protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{

(sender as RadGrid).DataSource = employeeList;  //This is a list of employee of values.. which comes from service layer.. of type .. List<Employee>

}



RadGrid UI Code


<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">

        <AjaxSettings>

            <telerik:AjaxSetting AjaxControlID="RadGrid1">

                <UpdatedControls>

                    <telerik:AjaxUpdatedControl ControlID="RadGrid1"></telerik:AjaxUpdatedControl>

                </UpdatedControls>

            </telerik:AjaxSetting>

        </AjaxSettings>

    </telerik:RadAjaxManager>

    <div>

        <telerik:RadGrid runat="server" ID="RadGrid1" AllowPaging="True" AllowSorting="true"

            OnNeedDataSource="RadGrid1_NeedDataSource"

..other code I removed it.. like the grid events and bound columns definitions

        </telerik:RadGrid>



RadComboBox Filter DataBinding Code in the Code Behind:

Protected Sub RadGrid1_ItemDataBound(sender As Object, e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound

If TypeOf e.Item Is Telerik.Web.UI.GridFilteringItem Then

    'Populate Filters by binding the combo to datasource

    Dim filteringItem As Telerik.Web.UI.GridFilteringItem = CType(e.Item, Telerik.Web.UI.GridFilteringItem)

    Dim myRadComboBox As Telerik.Web.UI.RadComboBox = DirectCast(filteringItem.FindControl("RadComboBoxDepartmentDescription"),Telerik.Web.UI.RadComboBox)



    myRadComboBox.DataSource = departmentList; //This is a collection which comes from service layer… and the type is List<Department>

    myRadComboBox.DataTextField = " DepartmentDescription"
    myRadComboBox.DataValueField = " DepartmentDescription"

    myRadComboBox.DataBind()

End If



Even I pasted the same code in ItemCreated Event as well but no luck…

 

Eyup
Telerik team
 answered on 07 Jul 2015
4 answers
64 views

Hi,

 

I have a RadComboBox inside the FilterTemplate with OnClientSelectedIndexChanged="NameFilterIndexChanged". I am making radgrid's AllowFilteringByColumn="Flase" when no data is available and AllowFilteringByColumn="true" when data is available.

 

 I am getting error like "0*800a1391 - JavaScript runtime error: 'NameFilterIndexChanged' is undefined" when AllowFilteringByColumn="true". Please help me on this.

 

Regards,

Venkatesh.

Eyup
Telerik team
 answered on 07 Jul 2015
4 answers
343 views
Is there any example to show how to set TemporaryFolderExpiration in web.config? 
Yang
Top achievements
Rank 1
 answered on 07 Jul 2015
1 answer
78 views

     I have a RadDatePicker rdp1 and a Radgrid with 1 RadDatePicker rdp2 in GridTemplateColumn in RadGrid with BatchEdit mode. I want that each time i choose date in rdp1 ( E.g: 20/10/2015 - dd/mm/yyyy ), rdp2 will auto set new value in all row  ( E.g: 10/15 - mm/yy ). That all what i want to do.

Any help appreciated,
Thanks,
Hiep

Eyup
Telerik team
 answered on 07 Jul 2015
2 answers
343 views

Hi guys,

 

I am having a RadHTMLChart which it shown in my attached file. I was wondering how do go about displaying number and the percentage base on each stacked column. Currently I am using the code snippet which is shown below:

DataTable source = getData(); // getting my data soruce
 
ColumnSeries colOnTime = new ColumnSeries();
colOnTime.Name = "WO on Time";
colOnTime.LabelsAppearance.Position = Telerik.Web.UI.HtmlChart.BarColumnLabelsPosition.Center;
colOnTime.Stacked = true;
colOnTime.Appearance.FillStyle.BackgroundColor = System.Drawing.ColorTranslator.FromHtml("#33CC33");
colOnTime.LabelsAppearance.ClientTemplate = "#if (value > 0) {# #=value# #} else {# #} #";
 
ColumnSeries colLate = new ColumnSeries();
colLate.Name = "WO less than " + ConfigurationManager.AppSettings["KPIThreshold"] + " days overdued";
colLate.LabelsAppearance.Position = Telerik.Web.UI.HtmlChart.BarColumnLabelsPosition.Center;
colLate.Stacked = true;
colLate.LabelsAppearance.ClientTemplate = "#if (value > 0) {# #=value# #} else {# #} #";
 
ColumnSeries colVeryLate = new ColumnSeries();
colVeryLate.Name = "WO more than " + ConfigurationManager.AppSettings["KPIThreshold"] + " days overdued";
colVeryLate.LabelsAppearance.Position = Telerik.Web.UI.HtmlChart.BarColumnLabelsPosition.Center;
colVeryLate.Appearance.FillStyle.BackgroundColor = System.Drawing.ColorTranslator.FromHtml("#B80000");
colVeryLate.Stacked = true;
colVeryLate.LabelsAppearance.ClientTemplate = "#if (value > 0) {# #=value# #} else {# #} #";
 
ColumnSeries grandTotal = new ColumnSeries();
grandTotal.Stacked = true;
grandTotal.LabelsAppearance.Position = Telerik.Web.UI.HtmlChart.BarColumnLabelsPosition.OutsideEnd;
grandTotal.Appearance.FillStyle.BackgroundColor = System.Drawing.Color.Transparent;
grandTotal.LabelsAppearance.ClientTemplate = "#if (value > 0) {# #=value# #} else {# #} #";
 
foreach (DataRow row in source.Rows)
{
    int? wo = Convert.ToInt32(row["onTime"]);
    colOnTime.SeriesItems.Add(wo);
    wo = Convert.ToInt32(row["late"]);
    colLate.SeriesItems.Add(wo);
    wo = Convert.ToInt32(row["verylate"]);
    colVeryLate.SeriesItems.Add(wo);
}
    chrtKPI.PlotArea.Series.Add(colOnTime);
    chrtKPI.PlotArea.Series.Add(colLate);
    chrtKPI.PlotArea.Series.Add(colVeryLate);
    chrtKPI.PlotArea.YAxis.LabelsAppearance.TextStyle.Padding = "5px";
    chrtKPI.DataBind();

Irving
Top achievements
Rank 2
 answered on 07 Jul 2015
4 answers
188 views

Hi

I design radgrid with advanced databinding.I want to show label message when radgrid is empty and is working perfectly fine but problem is that its also showing in the page load .radgrid bind with button click event if no data found then message will be display. ..by default radgrid shows message but its "No records to display "but its also visible on page load and radgrid dispersal on each post back ...i am working in user control in DNN here..Please suggest anyone how hide my label text in page load ...Thanx in advanced here my code

 protected void Page_Load(object sender, EventArgs e)
        {
           
            if (!Page.IsPostBack)
            {

                billingRadGrid.Visible = true;
            }
             
                BindComboBox();
                //lblMessage.Text = string.Empty;
                lblMessage.Visible = true;
            }

protected void billingRadGrid_OnNeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            billingRadGrid.DataSource = GetGridTable();
        }
        public DataTable GetGridTable()
        {
            Decimal amount_from;
            if (!Decimal.TryParse(amountFromTb.Text, out amount_from))
            {
                amount_from = 0;
            }
            Decimal amount_to;
            if (!Decimal.TryParse(amountToTb.Text, out amount_to))
            {
                amount_to = 0;
            }
            Decimal duration_from;
            if (!Decimal.TryParse(durationFromTb.Text, out duration_from))
            {
                duration_from = 0;
            }
            Decimal duration_to;
            if (!Decimal.TryParse(durationToTb.Text, out duration_to))
            {
                duration_to = 0;
            }
            string dateFrom = DateFromTb.Text;
            DateTime dateF = DateTime.ParseExact(dateFrom, "yyyy-MM-dd", null);
            string dateTo = DateToTb.Text;
            DateTime dateT = DateTime.ParseExact(dateTo, "yyyy-MM-dd", null);
            DataController dc = new DataController();
            BillingDetail bill = new BillingDetail();
            bill.accountNumber = "12004572";
            bill.fromDate = dateF;
            bill.toDate = dateT;
            bill.amountFrom = Convert.ToDecimal(amount_from);
            bill.amountTo = Convert.ToDecimal(amount_to);
            bill.durationFrom = Convert.ToDecimal(duration_from);
            bill.durationTo = Convert.ToDecimal(duration_to);
            bill.traficType = trafictypeCombo.SelectedItem.Text;
            bill.terminateState = stateNameTb.Text;
            bill.number = bTNComboBox.SelectedValue;
            bill.lineType = lineTypeComboBox.SelectedItem.Text;
            bill.dialedNum = Convert.ToString(dialedNumber.Text);
            DataTable dtBill = dc.GetUsageDetail_bill(bill);
            if (dtBill.Rows.Count > 0)
            {

                billingRadGrid.Visible = true;
                lblMessage.Text = string.Empty;
                lblMessage.Visible = false;
            }
            else
            {

                lblMessage.Visible = true;
                billingRadGrid.Visible = false;
                lblMessage.Text = "No Records To Display";
                lblMessage.ForeColor = Color.Red;
            }
            return dtBill;
        }

Mukul
Top achievements
Rank 1
 answered on 06 Jul 2015
2 answers
237 views

How to turn off 'Enable Track Changes Override' by default? I want want it to be ON only whne it is clicked.

I am using Telerik version  v2014.3.1209.35

kartik
Top achievements
Rank 1
 answered on 06 Jul 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?