Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
72 views
When the selected index changes in the combobox "ddlBuyers" other comboboxes in the grid get there value cleared? I have commented out the code that repopulates comboboxes for every row as this was resulting in very slow performance when we had large numbers of rows.

Please see the code bellow:

ASP:
<asp:TemplateField HeaderText="Buyer" HeaderStyle-Width="5.2%" ShowHeader="true">
                            <ItemTemplate>
                                <telerik:RadComboBox ID="ddlBuyers" runat="server" NoWrap="True" MaxHeight="300"
                                    Width="100%" CausesValidation="false" HighlightTemplatedItems="true" Skin="MetroTouch"
                                    AllowCustomText="false" MarkFirstMatch="True" CssClass="input-block-level" OnSelectedIndexChanged="ddlBuyers_SelectedIndexChanged"
                                    OnItemDataBound="ddlBuyers_ItemDataBound" OnClientKeyPressing="(function(sender, e){ if (!sender.get_dropDownVisible()) sender.showDropDown(); })"
                                    AutoPostBack="true" onkeydown="return ValidateEmpty(event,this);">
                                    <ItemTemplate>
                                        <ul>
                                            <li class="col1">
                                                <%# DataBinder.Eval(Container.DataItem, "BuyerCode")%>
                                            </li>
                                            <li class="col2">- </li>
                                            <li class="col3">
                                                <%# DataBinder.Eval(Container.DataItem, "BuyerName")%>
                                            </li>
                                        </ul>
                                    </ItemTemplate>
                                </telerik:RadComboBox>
                                <asp:TextBox ID="txtBuyer" runat="server" Height="36px" name="some_field" CssClass="input-block-level"
                                    Enabled="false" Text='<%#Eval("BuyerCode") %>' Visible="false"></asp:TextBox>
                                <asp:RequiredFieldValidator runat="server" Style="margin-left: 48%; display: block !important;
                                    padding-top: 0px; margin-top: 0px;" ID="rfvddlBuyers" Height="10" ForeColor="Red"
                                    ControlToValidate="ddlBuyers" ErrorMessage="*" ValidationGroup="AddClick"></asp:RequiredFieldValidator>
                            </ItemTemplate>
                            <ItemStyle CssClass="itmstyle" />
                        </asp:TemplateField>



C#:
                RadComboBox ddlBuyers = null;
                listBuyer = new List<Buyer>();
                listBuyer = ViewState["Buyer"] as List<Buyer>;
                buyer = new Buyer();
                RadComboBox ddl = (RadComboBox)sender;
                GridViewRow gvRow = (GridViewRow)ddl.Parent.Parent;
                int idx = Convert.ToInt32(gvRow.RowIndex);
                //foreach (GridViewRow row in grdWhiteFishSaleNotes.Rows)
                //{
                //    int index = Convert.ToInt32(row.RowIndex);
                //    ddlBuyers = row.FindControl("ddlBuyers") as RadComboBox;
                //    RadComboBox ddlBoxDestination = row.FindControl("ddlBoxDestination") as RadComboBox;
                //    RadComboBox ddlPresentation = row.FindControl("ddlPresentation") as RadComboBox;
                //    RadComboBox ddlDisposal = row.FindControl("ddlDisposal") as RadComboBox;
                //    RadComboBox ddlWithdrawnUsage = row.FindControl("ddlWithdrawnUsage") as RadComboBox;
                //    RadComboBox ddlPrivateSale = row.FindControl("ddlPrivateSale") as RadComboBox;
                //    RadComboBox ddlSpecies = row.FindControl("ddlSpecies") as RadComboBox;
                //    TextBox txtNoBoxes = row.FindControl("txtNoBoxes") as TextBox;
                //    TextBox txtFreeBoxes = row.FindControl("txtFreeBoxes") as TextBox;
                //    TextBox txtBoxWeight = row.FindControl("txtBoxWeight") as TextBox;
                //    TextBox txtTotalWeight = row.FindControl("txtTotalWeight") as TextBox;
                //    TextBox txtUnitPrice = row.FindControl("txtUnitPrice") as TextBox;
                //    TextBox txtActualCost = row.FindControl("txtActualCost") as TextBox;
                //    TextBox txtCostPerKilo = row.FindControl("txtCostPerKilo") as TextBox;

                //    if (idx == index)
                //    {


    RadComboBox ddlSpecies = grdWhiteFishSaleNotes.Rows[idx].FindControl("ddlSpecies") as RadComboBox;
    RadComboBox ddlBoxDestination = grdWhiteFishSaleNotes.Rows[idx].FindControl("ddlBoxDestination") as RadComboBox;
    ddlBuyers = grdWhiteFishSaleNotes.Rows[idx].FindControl("ddlBuyers") as RadComboBox;
                        ddlSpecies.Focus();

                        if (String.IsNullOrEmpty(ddlBuyers.SelectedValue))
                        {
                            ddlBuyers.SelectedValue = ddlBuyers.Text.Trim();
                        }

                        if (ViewState["Buyer"] != null)
                        {
                            var defaultDestinationList = listBuyer.Where(x => x.BuyerCode.Contains(ddlBuyers.Text.Trim())).ToList();

                            if (defaultDestinationList.Count > 0 && defaultDestinationList != null)
                            {
                                buyer = defaultDestinationList[0];

                                if (!String.IsNullOrEmpty(buyer.DefaultDestination))
                                {
                                    ddlBoxDestination.SelectedValue = buyer.DefaultDestination;
                                }

                            }
                        }

                        if (String.IsNullOrEmpty(ddlBuyers.SelectedValue))
                        {
                            ddlBoxDestination.ClearSelection();
                        }
                //    }
                //    else
                //    {
                //        ddlBoxDestination.SelectedValue = ddlBoxDestination.Text.Trim();
                //    }

                //   ddlSpecies.SelectedValue = ddlSpecies.Text.Trim();
                //    ddlPresentation.SelectedValue = ddlPresentation.Text.Trim();
                //    ddlDisposal.SelectedValue = ddlDisposal.Text.Trim();
                //    ddlWithdrawnUsage.SelectedValue = ddlWithdrawnUsage.Text.Trim();
                //    ddlPrivateSale.SelectedValue = ddlPrivateSale.Text;

                //    if (ddlDisposal.SelectedValue.Equals("WDR"))
                //    {
                //        ddlWithdrawnUsage.Enabled = true;
                //    }
                //    else
                //    {
                //        ddlWithdrawnUsage.ClearSelection();
                //        ddlWithdrawnUsage.Enabled = false;
                //    }

                //    txtNoBoxes.ToolTip = txtNoBoxes.Text;
                //    txtFreeBoxes.ToolTip = txtFreeBoxes.Text;
                //    txtBoxWeight.ToolTip = txtBoxWeight.Text;
                //    txtTotalWeight.ToolTip = txtTotalWeight.Text;
                //    txtUnitPrice.ToolTip = txtUnitPrice.Text;
                //    txtActualCost.ToolTip = txtActualCost.Text;
                //    txtCostPerKilo.ToolTip = txtCostPerKilo.Text;
                //    txtBoxes.ToolTip = txtBoxes.Text;
                //    txtWeight.ToolTip = txtWeight.Text;
                //    txtCost.ToolTip = txtCost.Text;

                //    if (!string.IsNullOrEmpty(ddlBuyers.SelectedValue))
                //    {
                //        ddlBuyers.ToolTip = ddlBuyers.SelectedValue;
                //    }

                //    if (!string.IsNullOrEmpty(ddlSpecies.SelectedValue))
                //    {
                //        ddlSpecies.ToolTip = ddlSpecies.SelectedValue;
                //    }










Peter
Top achievements
Rank 1
 asked on 26 Mar 2014
3 answers
130 views
I created a Telerik Web application C# project in VS2013 and found out that no client-side validation occurs. Is it expected due to the Telerik project template is missing any of MS js libraries? 
Misho
Telerik team
 answered on 26 Mar 2014
2 answers
160 views
Hello there,

I have a RadHtmlChart which has multiple LineSeries series.  In the legend, when clicking on the one of the series, it neatly toggles on and off that series from the chart. This functionality is really cool; however, I've been trying to figure out what is occurring behind the scenes.   Is the chart's repaint() function being called on each click?

Here is why I'm trying to further understand this.  I have a little function that I wrote that automatically hides every nth label along the x axis depending upon the number of data points there are after I bind some data client side.  It's a work around to the overcrowding of labels that can occur along the x-axis with large data sets. See attached image if I've lost you.

Anyways, when clicking on a series in the legend, it takes away that series as it should, but all of the date labels have reappeared as shown in attached 2.  I'm looking for an event to be able to hook into so I can call my function that hides the labels.

I appreciate all input and ideas.
Avs8686
Top achievements
Rank 1
 answered on 26 Mar 2014
1 answer
296 views
I am trying to get a gridview to display a clickable icon that shows the current status of the gridview item which can be sorted and filtered. When clicked the status image should toggle between active / Inactive / Unknown images and update the appropriate item's status in the DB(immediately or after a save changes button is pressed, either way). The DB stores the status as an int where 0 = inactive, 1 = active, and any other number is unknown.  The radGrid uses an objectDataSource to access the DB which contains the int as 'Status'.

I tried to use an itemTemplate With a radButton with a buttonType of ToggleButton, a ToggleType of CustomToggle And three toggleStates (one for each status),  while the toggling between the images worked, I can't seem to bind original(default) toggleState to the 'Status' value, and being able to sort/filter based on that. 

.aspx:
01.<telerik:RadGrid ID="InvQryList" runat="server" AllowFilteringByColumn="True"
02.            AllowSorting="True" AutoGenerateDeleteColumn="True" DataSourceID="InvQryDS"
03.            Skin="Windows7">
04.            <ClientSettings EnableRowHoverStyle="True">
05.            </ClientSettings>
06.            <MasterTableView AutoGenerateColumns="False" DataSourceID="InvQryDS" FilterExpression="(it.Active != 0)">
07.              <Columns>
08.                ... Other Columns ...
09.                <telerik:GridTemplateColumn HeaderText="Active Toggle" DataField="Active">
10.                 <ItemTemplate>
11.                  <telerik:RadButton ID="ActiveToggle" runat="server" ButtonType="ToggleButton" ToggleType="CustomToggle" AutoPostBack="false"
12.                   Width="16px" Height="16px">
13.                  <ToggleStates>
14.                    <telerik:RadButtonToggleState Value="1" ImageUrl="img/spheres/green-16x16x32.png" />
15.                    <telerik:RadButtonToggleState Value="0" ImageUrl="img/spheres/red-16x16x32.png" />
16.                    <telerik:RadButtonToggleState Value="-1" ImageUrl="img/spheres/grey-16x16x32.png" />
17.                  </ToggleStates>
18.                  </telerik:RadButton>
19.                 </ItemTemplate>
20.                </telerik:GridTemplateColumn>
21.              </Columns>
22.            </MasterTableView>
23.          </telerik:RadGrid>

Any Help would be Great
 

 

 
Konstantin Dikov
Telerik team
 answered on 26 Mar 2014
0 answers
119 views
Hello

Using SqlDataSource Control Parameter for filtering my Database dynamically.
I wonder can i use Stored Procedure for controlling Database dynamically like SqlDataSource?

Thanks in advance

omer
Top achievements
Rank 1
 asked on 26 Mar 2014
7 answers
277 views
RadAsyncUpload in Grid

I noticed this on the Upload example:

"You need to ensure that any submit buttons on the page are disabled while upload is in progress. Otherwise, there is no guarantee that the files will be uploaded successfully"

How would I do that?

Marty
moegal
Top achievements
Rank 1
 answered on 26 Mar 2014
4 answers
139 views
Hey,

When using the RadEditor to markup some html5 microdata, it seems to strip out the 'itemscope' property.

So when in HTML pane pasting something like:
<span itemprop="geo" itemscope itemtype="http://schema.org/GeoCoordinates">
    <meta itemprop="latitude" content="1.23456" />
    <meta itemprop="longitude" content="1.23456" />
</span>

it saves it like this:

<span itemprop="geo" itemtype="http://schema.org/GeoCoordinates">
    <meta itemprop="latitude" content="1.23456" />
    <meta itemprop="longitude" content="1.23456" />
</span>

This happens both on <span> and <div> and not just on geo microdata but all items containing 'itemscope'.

In this case I'm using the RadEditor inside Sitefinity v5.1, but after confirming Sitefinity doesn't strip/filter anything and its a RadEditor issue, I'm posting the question here...

Has anyone run into this and found a workaround ?

Jochem
Petar
Top achievements
Rank 1
 answered on 26 Mar 2014
1 answer
89 views
In development when I add the Filemanager to a screen and try to open the file explorer I get the error

HTTP Error 403.14 - ForbiddenThe Web server is configured to not list the contents of this directory.

I and just trying to access a subfolder in the web directory on my machine in VS2013
Frank
Top achievements
Rank 1
 answered on 26 Mar 2014
5 answers
328 views
I am not able to bind this checkbox to a nullable bit in sql:
<EditFormSettings EditFormType="Template">
  <FormTemplate>
  <telerik:RadButton ID="btnToggle"  runat="server" ToggleType="CheckBox" ButtonType="LinkButton" Checked='<%# Bind("inBudgetPCS") %>' >
  <ToggleStates>
   <telerik:RadButtonToggleState Text="In Budget" PrimaryIconCssClass="rbToggleCheckboxChecked" />
   <telerik:RadButtonToggleState Text="Not in Budget" PrimaryIconCssClass="rbToggleCheckbox" />
 </ToggleStates>
</telerik:RadButton>
  </FormTemplate>
</EditFormSettings>
It keeps generating "Invalid cast exception"
Maria Ilieva
Telerik team
 answered on 26 Mar 2014
4 answers
1.4K+ views
What's the best way to show Yes/No for boolean columns instead of true false? I don't want to change it in the SQL, because it would affect my ability to query and sort.

Thanks,
Andrew
Stef
Telerik team
 answered on 26 Mar 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
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
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
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
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?