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

 

 

I have a combo box like this

<
telerik:RadComboBox ID="rcbAssets" runat="server" TabIndex="5" OnClientDropDownOpening="LoadAssets" OnItemsRequested="rcbAssets_ItemsRequested" OnClientDropDownClosed="showAssets"

 

 

 

AutoPostBack="false" Width="250px" >

 

 

 

<ItemTemplate>

 

 

 

<div>

 

 

 

<asp:CheckBox runat="server" ID="chk1" />

 

 

 

<asp:Label runat="server" ID="Label1" AssociatedControlID="chk1">

 

<%

 

# Eval("AssetNumber")%>

 

 

 

</asp:Label>

 

 

 

</div>

 

 

 

</ItemTemplate>

 

 

 

</telerik:RadComboBox>

In code behind, I tried to check some check boxes and set the text of the radcombobox...

 

 

 

 

 

rcbSimilarParts.Text = "12354,12347";


This text is not displaying

Shinu
Top achievements
Rank 2
 answered on 21 May 2013
2 answers
150 views

I'm trying to filter two different (Data Picker's) that are in the same column at the grid. I try to reach a command with these two fields. The whole filtering process is going on in the code behind, and so far it is working for the other fields in the grid. But for one I'm getting a strange exception:

{"The argument types 'Edm.DateTime' and 'Edm.String' are incompatible for this operation. Near greater than or equals expression, line 6, column 15."}

In the DB the field is a datetime and it is a single column

My code :

                    <telerik:GridBoundColumn DataField="EntryDate" DataType="System.DateTime" DataFormatString="{0:dd/MM/yyyy}" FilterControlAltText="Filter EntryDate column"
                        HeaderText="Date" SortExpression="EntryDate" UniqueName="EntryDate" FilterControlWidth="50px">
                        <FilterTemplate>
                            From
                            <telerik:RadDatePicker ID="FromOrderDatePicker" runat="server" Width="100px" AutoPostBack="true"
                                OnSelectedDateChanged="FromOrderDatePicker_SelectedDateChanged" OnPreRender="FromOrderDatePicker_PreRender" />
                            to
                            <telerik:RadDatePicker ID="ToOrderDatePicker" runat="server" Width="100px" AutoPostBack="true"
                                OnSelectedDateChanged="ToOrderDatePicker_SelectedDateChanged" OnPreRender="ToOrderDatePicker_PreRender" />

                        </FilterTemplate>
                    </telerik:GridBoundColumn> 

Code behind:

     protected void FromOrderDatePicker_SelectedDateChanged(object sender, Telerik.Web.UI.Calendar.SelectedDateChangedEventArgs e)
            {
                RadDatePicker picker = sender as RadDatePicker;
                ViewState["FromDatePicker"] = DateTimeToString(picker.SelectedDate.Value);

                ExpressionChanged();
            }
            protected void FromOrderDatePicker_PreRender(object sender, EventArgs e)
            {
                if (ViewState["FromDatePicker"] != null)
                {
                    RadDatePicker picker = sender as RadDatePicker;
                    picker.SelectedDate = StringToDateTime(ViewState["FromDatePicker"].ToString());
                }
            }


  private string DateTimeToString(DateTime dt)
    {
        return dt.Month + "/" + dt.Day + "/" + dt.Year;
    }
    private DateTime StringToDateTime(string s)
    {
        string[] dts = s.Split('/');
        DateTime dt = new DateTime(Int32.Parse(dts[2]), Int32.Parse(dts[0]), Int32.Parse(dts[1]));
        return dt;
    }

It would be just redundant to post the code (for the toDatePicker)

 private void ExpressionChanged()
    {
        //reset
        TimeReportGrid.MasterTableView.FilterExpression = null;
        TimeReportGrid.MasterTableView.Rebind();


        if (ViewState["FromDatePicker"] != null &&
            ViewState["ToDatePicker"] != null &&
            ViewState["FromDatePicker"].ToString() != "" &&
            ViewState["ToDatePicker"].ToString() != "")
        {
            TimeReportGrid.MasterTableView.FilterExpression += "(it.EntryDate >= '" + ViewState["FromDatePicker"].ToString() + "') AND (it.EntryDate <= '" + ViewState["ToDatePicker"].ToString() + "')";
        }

feel free to ask if there is any problem

Thanks for help and fast answer !

Nikola
Top achievements
Rank 2
 answered on 21 May 2013
1 answer
79 views
HI ,
i am working on Asp.Net Application. Can you please suggest how do we check user is currently logged in my site using Ajax .
regards,
Anandharaj
Anandharaj
Top achievements
Rank 1
 answered on 21 May 2013
4 answers
300 views
I have a situation where I have your RadContextMenu appearing when I right-click on any RadListBox item.  The problem is that the tooltip obscures (covers up) the Context Menu.

Might there be a way to adjust the position of either the tooltip or the Context Menu?  I assume this can be done with CSS code but I don't know the syntax/structure for either.

Any help would be much appreciated.

Thank you,

Robert W.
Robert
Top achievements
Rank 1
 answered on 21 May 2013
2 answers
86 views

Hi Sir/Madam
   I want to create ItemTemplate dynamically based on FromMonthDropDownList  and ToMonthDropDownList drop down.
  Column varies depends upon dates selected. I can not access the  FromMonthDropDownList.SelectedValue; in page_init.
  If i create the ItemTemplate elsewhere i can not export to Excel.
Is there any workaround to accomplish this task?



protected void Page_Init(object sender, EventArgs e)
    {
        
        string FromYearMonth = FromMonthDropDownList.SelectedValue;
        string ToYearMonth = ToMonthDropDownList.SelectedValue;

        rgPartSalesByVendor.MasterTableView.Columns.Clear();
        GridBoundColumn boundColumnVendor = new GridBoundColumn();
        boundColumnVendor.DataField = "Vendor";
        boundColumnVendor.UniqueName = "Vendor";
        boundColumnVendor.HeaderText = "Vendor";
        rgPartSalesByVendor.MasterTableView.Columns.Add(boundColumnVendor);

        //Bind sales By vendor Grid
        SqlDataSource1.SelectParameters["StartMonth"].DefaultValue = FromYearMonth.Substring(4, 2);
        SqlDataSource1.SelectParameters["StartYear"].DefaultValue = FromYearMonth.Substring(0, 4); //ddlStartYear.SelectedValue;
        SqlDataSource1.SelectParameters["EndMonth"].DefaultValue = ToYearMonth.Substring(4, 2); // ddlEndMonth.SelectedValue;
        SqlDataSource1.SelectParameters["EndYear"].DefaultValue = ToYearMonth.Substring(0, 4);  //ddlEndYear.SelectedValue;
        rgPartSalesByVendor.DataSource = SqlDataSource1;
        DataTable dt = null;
        DataView dv = null;
        dv = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);

        for (int idx = rgPartSalesByVendor.MasterTableView.Columns.Count - 1; idx > 0; idx--)
        {
            rgPartSalesByVendor.MasterTableView.Columns.RemoveAt(idx);
        }
        if (dv != null)
        {
            dt = dv.ToTable();
            CreateTemplateColumn(dt);
        }

}

 private void CreateTemplateColumn(DataTable dt)
    {
        foreach (DataColumn dc in dt.Columns)
        {
            if (dc.ColumnName == "Vendor" || dc.ColumnName == "vendorID")
                continue;
            if (dc.ColumnName != "Vendor" && dc.ColumnName != "VendorID")
            {
                string ColName = dc.ColumnName;
                string[] DPMNameAndID = ColName.Split(';');
                string DPMName = DPMNameAndID[0];
                string DMPId = DPMNameAndID[1];
                GridTemplateColumn templateColumn = new GridTemplateColumn();
                templateColumn.ItemTemplate = new MyTemplate(ColName, FromMonthDropDownList.SelectedValue, ToMonthDropDownList.SelectedValue);
                templateColumn.SortExpression = ColName;
                templateColumn.HeaderText = DPMName;
                templateColumn.HeaderStyle.Font.Bold = true;
                templateColumn.FooterStyle.Font.Bold = true;
                templateColumn.FooterAggregateFormatString = "{0:F2}";
                templateColumn.DataField = ColName;
                templateColumn.Aggregate = Telerik.Web.UI.GridAggregateFunction.Sum;
                this.rgPartSalesByVendor.MasterTableView.Columns.Add(templateColumn);
            }
        }
    }


    private void CreateTemplateColumn(DataTable dt)
    {
        foreach (DataColumn dc in dt.Columns)
        {
            if (dc.ColumnName == "Vendor" || dc.ColumnName == "vendorID")
                continue;
            if (dc.ColumnName != "Vendor" && dc.ColumnName != "VendorID")
            {
                string ColName = dc.ColumnName;
                string[] DPMNameAndID = ColName.Split(';');
                string DPMName = DPMNameAndID[0];
                string DMPId = DPMNameAndID[1];
                GridTemplateColumn templateColumn = new GridTemplateColumn();
                templateColumn.ItemTemplate = new MyTemplate(ColName, FromMonthDropDownList.SelectedValue, ToMonthDropDownList.SelectedValue);
                templateColumn.SortExpression = ColName;
                templateColumn.HeaderText = DPMName;
                templateColumn.HeaderStyle.Font.Bold = true;
                templateColumn.FooterStyle.Font.Bold = true;
                templateColumn.FooterAggregateFormatString = "{0:F2}";
                templateColumn.DataField = ColName;
                templateColumn.Aggregate = Telerik.Web.UI.GridAggregateFunction.Sum;
                this.rgPartSalesByVendor.MasterTableView.Columns.Add(templateColumn);
            }
        }
    }

    private class MyTemplate : ITemplate
    {
   
        protected HyperLink SealeByVendorTrans;
       
        private string colname;
        private string _fromDate;
        private string _toDate;
        public MyTemplate(string cName,string fromDate,string toDate)
        {
            colname = cName;
            _fromDate = fromDate;
            _toDate = toDate;
        }
        public void InstantiateIn(System.Web.UI.Control container)
        {
            SealeByVendorTrans = new HyperLink();
            SealeByVendorTrans.ID = colname;
            SealeByVendorTrans.DataBinding += new EventHandler(SealeByVendorTrans_DataBinding);
            container.Controls.Add(SealeByVendorTrans);
        }
        void SealeByVendorTrans_DataBinding(object sender, EventArgs e)
        {
            HyperLink link = (HyperLink)sender;
            GridDataItem container = (GridDataItem)link.NamingContainer;
            link.Text = ((DataRowView)container.DataItem)[colname].ToString();
            link.NavigateUrl = "HinoPartsDashBoardTransactions.aspx?TransType=V&type=Vendor&SalesType=T&from=" + _fromDate + "&to=" + _toDate+"&VendorID="+((DataRowView)container.DataItem)["VendorID"].ToString();
        }
    }
    #endregion
Balkar
Top achievements
Rank 1
 answered on 20 May 2013
1 answer
245 views
Hi,
I noticed that one of my dropdownlists always posts back instead of doing an asynchronous refresh of the updatepanel.When I remove ClientIDMode="Static", everything works fine.

Thanks

Madani
Danail Vasilev
Telerik team
 answered on 20 May 2013
2 answers
181 views
Hello!

I need to know how to allow users to select one row of a RadGrid at a time (client-side), without having everything de-selected with a click. I've done this server-side, so now I'm trying to do this client side. Here is what I have figured out so far:

I first create an Array() object to hold the unique IDs of the rows that are to stay selected:

var uniqueIdArray = new Array();

Next, I have subscribed to the ClientEvents OnRowSelected and OnRowDeselected events with these functions:

// Add the ID to the array of selected rows.
function ThemeSelected(sender, args) { 
     uniqueIdArray.push(args.getDataKeyValue("IdNo"));
}

// Remove the ID to the array of selected rows.
function ThemeDeselected(sender, args) {
      uniqueIdArray.splice(selThemes.indexOf(args.getDataKeyValue("IdNo")), 1);
 }

Now what I need is a function that would force the rows that are selected to stay selected. The variable "uniqueIdArray" has the items that are selected. But, if I click on another row (to select it), the first thing that is fired is the "deselection" prior to the selection of the new row.

So, how do I cancel deselects when I don't want them?

Thanks!

-Eric
Eric
Top achievements
Rank 1
 answered on 20 May 2013
5 answers
134 views
I am seeing some display issues with the RadComboBox in IE8. I have attached a screen shot.

Is this a known bug, or is there a way I can correct this on my end?
Teo
Top achievements
Rank 1
 answered on 20 May 2013
1 answer
144 views

I make a Website and Post to somee.com, my site is "tinhdamsugia.somee.com".

have a error.

Server Error in '/' Application.

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server).

Microsoft help me please.
my email: tinhdamsugia@yahoo.com

Danail Vasilev
Telerik team
 answered on 20 May 2013
6 answers
194 views
Hi,
I am using RadButton to cross post a page, NewOrder.aspx, to another page,SaveOrder.aspx. the form is submitted and processed in the target page but the browser stays at the first page.
if i change the RadButton to asp:Button, it works and SaveOrder.aspx is displayed.
here's my markup for the button in NewOrder.aspx that is submitting to SaveOrder.aspx

<telerik:RadButton ID="BtnSubmirOrder" runat="server" ButtonType="StandardButton" AutoPostBack="true"
                Text="Place order" PostBackUrl="SaveOrder.aspx">
 </telerik:RadButton>

in SaveOrder.aspx i have this
protected void Page_Load(object sender, EventArgs e)
    {
        if (PreviousPage==null || !PreviousPage.IsCrossPagePostBack)
            Response.Redirect("~/Default.aspx");
 
        var referencingPage = PreviousPage as NewOrder;
        int id = Int32.Parse(referencingPage.SelectedPublicationId);
 
 
        DateTime neededBy = referencingPage.SelectedOrderDate;
 
        LblSummaryIsbn.Text = referencingPage.SelectedIsbn;
        LblSummaryNbrCopies.Text = referencingPage.NbrOfOrderedCopies;
        DateTime orderDate = DateTime.Now;
        LblSummaryOrderDate.Text = orderDate.ToShortDateString();
        LblSummaryTitle.Text = referencingPage.SelectedPublicationTitle;
        int quantity = Int32.Parse(referencingPage.NbrOfOrderedCopies);
        StockContainer _context = new StockContainer();
        Order newOrder = Order.CreateOrder(orderDate, quantity, neededBy, id);
        _context.Orders.AddObject(newOrder);
        _context.SaveChanges();
    }

basically the user fills an order in NewOrder.aspx and submits it using the RadButton to SaveOrder.aspx where it will be saved . SaveOrder.aspx will return some information back to the user. its Page_Load method executes but the browser stays at NewOrder.aspx. what i am doing wrong? thanks
Danail Vasilev
Telerik team
 answered on 20 May 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?