Telerik Forums
UI for ASP.NET AJAX Forum
17 answers
1.4K+ views
I have a rad upload on a user control and i cannot upload my files because after debugging, i found that RadUpload1.UploadedFiles.Count = 0.  i've looked at the examples and I'm at a loss.  My code is below.  What am I missing?

ASPX
<telerik:RadUpload ID="RadUpload1" runat="server" EnableEmbeddedSkins="false" Skin="Hay2" InitialFileInputsCount="3" ControlObjectsVisibility="All" InputSize="75" Width="700px" />

C#
if (RadUpload1.UploadedFiles.Count > 0)
{
    foreach (UploadedFile validFile in RadUpload1.UploadedFiles)
{
    string targetFolder = Server.MapPath("/attachments/");
    validFile.SaveAs(
Path.Combine(targetFolder, validFile.GetName()), true);
}
labelNoResults.Visible =
false;
repeaterValidResults.Visible =
true;
repeaterValidResults.DataSource = RadUpload1.UploadedFiles;
repeaterValidResults.DataBind();
}
else
{
labelNoResults.Visible =
true;
repeaterValidResults.Visible =
false;
}
Peter Filipov
Telerik team
 answered on 10 Jul 2012
1 answer
65 views
I have a page that contains one Button and one Iframe.
The Button opens one popup(jquery dialog) and the Iframe contains one Telerik.ReportViewer.WebForms.
My problem is that when i open the popup that is above the report, the dropdown from the report tools overlaps the popup.
 
  This problem occurs only on internet explorer 6.

P.S. I have noticed that the export feature does not work :(
Steve
Telerik team
 answered on 10 Jul 2012
3 answers
78 views
I am very new at this so, sorry if this is very basic.

I got a rad grid for all my employees and am trying to have a Race, Sex and Classification drop down box to populate the data.

Is there a way to do that right in the editor?

Do I just replace my bound fields with the dropdownboxes and enter the list of available choices somewhere? 

I can not seem to find a way to do this?

Thanks
Matt
Eyup
Telerik team
 answered on 10 Jul 2012
1 answer
75 views
Hello all ,

i've nested radgrid : Radgrid2 into radgrid1

and i want to get the selected row id when "onRowClick" event fires ,

i wrote this js function :   

 function RowClick(sender, eventArgs) {
        var grid = sender;
        var MasterTable = grid.get_masterTableView();
        var row = MasterTable.get_dataItems()[eventArgs.get_itemIndexHierarchical()];
        var cell = MasterTable.getCellByColumnUniqueName(row, "Forum_id");
        alert(cell.innerHTML);
    }
 

the client side code is :
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
            <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="true"  OnItemCommand="RadGrid1_ItemCommand" >           
                    <MasterTableView>
                    <NestedViewTemplate>
                        <telerik:RadGrid ID="RadGrid2" runat="server" AllowPaging="True" OnNeedDataSource="RadGrid2_NeedDataSource">                                 
                               <ClientSettings>
                
        <ClientEvents OnRowClick="RowClick"/>
    </ClientSettings>
                       </telerik:RadGrid>
      
                    </NestedViewTemplate>                    
                </MasterTableView>
                <ClientSettings>     
        <ClientEvents OnRowClick="RowClick"/>
    </ClientSettings>
            </telerik:RadGrid>
        </telerik:RadAjaxPanel>

when i click on a row of radgrid1 , js function works rightly .
but when i click on a row of radgrid2 , 2 alert messages appear : the first one gives me the right selected id (what i want ) but the other one gives me the the selected index ..  

how to prevent "onRowClick" event to fire 2 times when i click on radgrid2??  
Tsvetoslav
Telerik team
 answered on 10 Jul 2012
1 answer
85 views
Hi,

I have a RadGrid Control on my WebPage with an editable column.
After edit this column and postback the request, inside the CSharp event

protected void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
    {
// rg is the RadGrid       
        if (rg != null)
        {
            if (e.Argument == string.Empty)
            {
                rg.Rebind();
            }

            string[] editedItemIds = e.Argument.Split(':');
            int i;
            for (i = 0; i <= editedItemIds.Length - 2; i++)
            {
                try
                {
                    Guid itemId = Guid.Parse(editedItemIds[i]);

//This is the row that give the problem

                    GridDataItem updatedItem = rg.MasterTableView.FindItemByKeyValue("ArticoloId", itemId);
                   
                    UpdateValues(itemId, updatedItem);
                }
                catch
                {
                }
            }
            rg.Rebind();
        }
    }


As told before the rg.MasterTableView.Items collection is empty and so the method "FindItemByKeyValue" does not never return any value.
I follow your example at
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/clienteditbatchupdates/defaultcs.aspx

Your help will be much appreciated.
Thanks in advance.

Tsvetoslav
Telerik team
 answered on 10 Jul 2012
3 answers
291 views
Hi, i have been using the RadScheduler for a few Days. I want to Display Data from my Database in the Calendar.

My Table looks like that:

RoomName
Description
From-Date
Until-Date

I want to display these Data in the Calendar. I added a SqlDataSource and established an Connection to my Database. I tested the Query and it works. 

My Question is, how can i use this Data to Display the different Appointments in the Calendar. I only want to display them. No new Insert or Update.


Thanks in advcance
Vijaianand
Top achievements
Rank 1
 answered on 09 Jul 2012
2 answers
154 views
I've been searching through the documentation to do a simple server-side select and access the data in that row. I found this page here (http://www.telerik.com/help/aspnet-ajax/grid-retrieve-primary-key-field-values-for-items.html) and used a line from the sample code:

RadGrid1.SelectedItems[0].GetDataKeyValue("CustomerID").ToString()

Visual Studio gives me an error of "'Telerik.Web.UI.GridItem' does not contain a definition for 'GetDataKeyValue' and no extension method 'GetDataKeyValue' accepting a first argument of type 'Telerik.Web.UI.GridItem' could be found (are you missing a using directive or an assembly reference?)"

I tried a different route using this:

grd.SelectedItems[0].Cells[1].Text

but this doesn't return anything at runtime, regardless of the index I use for the cells collection.

Please advise. Thanks guys!

Darren
Top achievements
Rank 2
 answered on 09 Jul 2012
2 answers
134 views
The project got a RadSlider, a RadNumericTextBox and a Label. Changing values ​​RadSlider the value shown in RadNumericTextBox, Label displays the function result (deposit + interest).

The problem is that I can not create an event that would change the values ​​in RadNumericTexBox (change clients) value delegated to RadSlider.

<script type="text/javascript">
        function ManualValueChange(sender, eventArgs) {
            $get("CalcSlider").value = sender.get_newValue();
        }
    </script>
    <telerik:RadAjaxManager ID="PpAjaxManager" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="CalcSlider">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="CalcSliderDeposit" UpdatePanelRenderMode="Inline" />
                    <telerik:AjaxUpdatedControl ControlID="lblYouHave" UpdatePanelRenderMode="Inline" />
                    <telerik:AjaxUpdatedControl ControlID="lblprofit" UpdatePanelRenderMode="Inline" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="CalcSliderDeposit">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="CalcSlider" UpdatePanelRenderMode="Inline" />
                    <telerik:AjaxUpdatedControl ControlID="lblYouHave" UpdatePanelRenderMode="Inline" />
                    <telerik:AjaxUpdatedControl ControlID="lblprofit" UpdatePanelRenderMode="Inline" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
   <div class="typeCalc">
                    <br />
                    <table style="width: 640px; margin: 0 auto;">
                        <tr>
                            <td colspan="2" style="height: 20px; text-align: center">
                                <h3>
                                    BondMarketers Invest Plan</h3>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" style="height: 80px; border-top: 1px solid gray; text-align: center">
                                <telerik:RadSlider ID="CalcSlider" runat="server" Skin="Black" MinimumValue="0" MaximumValue="10000"
                                    LargeChange="2000" SmallChange="10" Width="650px" Height="65px" ItemType="Tick"
                                    TrackPosition="TopLeft" AnimationDuration="600" ShowDragHandle="false" OnValueChanged="CalcSliderValueChanged"
                                    AutoPostBack="true">
                                </telerik:RadSlider>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" style="height: 20px">
                                  
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 200px; text-align: center">
                                Invest:
                            </td>
                            <td>
                                <telerik:RadNumericTextBox runat="server" ID="CalcSliderDeposit" Type="Currency"
                                    Culture="en-US" DataType="System.Decimal" AutoPostBack="true">
                                    <ClientEvents OnValueChanged="ManualValueChange" OnLoad="ManualValueChange" />
                                </telerik:RadNumericTextBox>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" style="height: 20px">
                                  
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 200px; text-align: center">
                                <asp:Label runat="server" ID="lblYouHave" />
                            </td>
                            <td>
                                <asp:Label runat="server" ID="lblprofit" Font-Bold="True" Font-Size="Larger" ForeColor="Green" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" style="height: 20px">
                                  
                            </td>
                        </tr>
                    </table>
                </div>


Method to change the values​​:

protected void CalcSliderValueChanged(object sender, EventArgs e)
       {
           double percent = FormulaLayer.FormulaValue((decimal)CalcSlider.Value);
           decimal deposit = (decimal)CalcSlider.Value;
           int percents = 100;
 
           DateTime sDate = DateTime.Now;
           DateTime eDate = DateTime.Now.AddDays(365);
 
           CalcSliderDeposit.Value = Convert.ToDouble(deposit);
            
                
           lblYouHave.Text = "You have: ";
 
           lblprofit.Text = string.Format("${0}", ((Convert.ToDouble(deposit) / percents) * percent * Convert.ToDouble(FormulaLayer.GetWorkDayCount(sDate, eDate)) + Convert.ToDouble(CalcSlider.Value)));
       }


Thanks for any help.

Sorry for my bad english... :D
Patrik
Top achievements
Rank 2
 answered on 09 Jul 2012
1 answer
224 views
What I am trying to do is uncheck another checkbox in the same row. I want to have a subscribe and unsubscribe checkbox columns. So when you click on subscribe the unsubscribe checkbox should uncheck and vise versa. I found a lot of entries that are similar in the forums but didnt come across anything in this. Found something in the old ASP forum but its not working. Below is what I ahve.

Source
<telerik:RadGrid ID="grdPubList" runat="server" Skin="Office2007" GridLines="None"
                                               AutoGenerateColumns="False" AllowNaturalSort="false" CellSpacing="0">
                                               <HeaderStyle Width="100px" HorizontalAlign="Center" />
                                               <ClientSettings>
                                                   <Selecting CellSelectionMode="None"></Selecting>
                                               </ClientSettings>
                                               <MasterTableView AllowMultiColumnSorting="true" ShowHeadersWhenNoRecords="false">
                                                   <NoRecordsTemplate />
                                                   <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                                                   <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                                                   </RowIndicatorColumn>
                                                   <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                                                   </ExpandCollapseColumn>
                                                   <Columns>
                                                       <telerik:GridTemplateColumn ItemStyle-Width="250px" HeaderStyle-Width="250px" ItemStyle-HorizontalAlign="Left"
                                                           ItemStyle-VerticalAlign="Top" HeaderText="Publication Name">
                                                           <ItemTemplate>
                                                               <asp:Label ID="lblPubId" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.PubID").ToString() %>'
                                                                   CssClass="label_default_nb" Visible="false"></asp:Label>
                                                               <asp:Label ID="lblPubName" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Name").ToString() %>'
                                                                   CssClass="label_default_nb"></asp:Label>
                                                           </ItemTemplate>
                                                           <HeaderStyle Width="250px"></HeaderStyle>
                                                           <ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Width="250px"></ItemStyle>
                                                       </telerik:GridTemplateColumn>
                                                       <%--<telerik:GridBoundColumn HeaderText="Practice Area" DataField="departmentDescription"
                                                           AllowSorting="false" ItemStyle-HorizontalAlign="Left" ItemStyle-VerticalAlign="Top"
                                                           ItemStyle-Width="100px" HeaderStyle-Width="50px">
                                                           <HeaderStyle Width="50px"></HeaderStyle>
                                                           <ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Width="100px"></ItemStyle>
                                                       </telerik:GridBoundColumn>--%>
                                                       <%--<telerik:GridTemplateColumn ItemStyle-HorizontalAlign="Center" ItemStyle-Wrap="False"
                                                           ItemStyle-VerticalAlign="Top" HeaderText="Modified <br> By/Date" UniqueName="ModifiedByDate"
                                                           ItemStyle-Width="100px" HeaderStyle-Width="100px">
                                                           <ItemTemplate>
                                                               <asp:Label ID="lblUserModified" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.userModified").ToString() %>'
                                                                   CssClass="label_default_nb" Width="100px"></asp:Label>
                                                               <asp:Label ID="lblDateModified" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.dateModifiedStr").ToString() %>'
                                                                   CssClass="label_default_nb" Width="100px"></asp:Label>
                                                           </ItemTemplate>
                                                       </telerik:GridTemplateColumn>--%>
                                                       <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn1 column"
                                                           HeaderText="Format" UniqueName="typeDescription" DataField="typeDescription">
                                                           <ItemTemplate>
                                                               <asp:Label ID="lblPubType" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.typeDescription").ToString() %>'
                                                                   CssClass="label_default_nb"></asp:Label>
                                                           </ItemTemplate>
                                                       </telerik:GridTemplateColumn>
                                                       <telerik:GridTemplateColumn HeaderText="Subscribe">
                                                           <ItemTemplate>
                                                               <asp:CheckBox ID="radchkSubscribe" runat="server" />
                                                           </ItemTemplate>
                                                       </telerik:GridTemplateColumn>
                                                       <telerik:GridTemplateColumn HeaderText="Unsubscribe">
                                                           <ItemTemplate>
                                                               <asp:CheckBox ID="radchkUnsubscribe" runat="server" />
                                                           </ItemTemplate>
                                                       </telerik:GridTemplateColumn>
                                                   </Columns>
                                                   <EditFormSettings>
                                                       <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                                                       </EditColumn>
                                                   </EditFormSettings>
                                               </MasterTableView>
                                               <FilterMenu EnableImageSprites="False">
                                               </FilterMenu>
                                           </telerik:RadGrid>


VB code in the page. 
Private Sub grdPubList_ItemCreated(sender As Object, e As Telerik.Web.UI.GridItemEventArgs) Handles grdPubList.ItemCreated
      If TypeOf e.Item Is GridDataItem Then
          Dim item As GridDataItem = DirectCast(e.Item, GridDataItem)
          Dim chk1 As CheckBox = DirectCast(item.FindControl("radchkSubscribe"), CheckBox)
          Dim chk2 As CheckBox = DirectCast(item.FindControl("radchkUnsubscribe"), CheckBox)
          'Dim chk3 As CheckBox = DirectCast(item.FindControl("CheckBox3"), CheckBox)
          chk1.Attributes.Add("onclick", (("checkUncheck('" + chk1.ClientID & "','") + chk2.ClientID & "',')"))
           
      End If
  End Sub


Javascript in masterpage. Though i think the ch2.checked should be false in the if and true in the else.
<script type="text/javascript">
       function checkUncheck(c1, c2) {
           var ch1 = document.getElementById(c1);
           var ch2 = document.getElementById(c2);
 
           if (ch1.checked) {
               ch2.checked = true;
 
           }
           else {
               ch2.checked = false;
 
           }
       }    
   </script>

Casey
Top achievements
Rank 1
 answered on 09 Jul 2012
1 answer
112 views
I have a switch statement in a javascript function that performs different actions based on the type of control that is being passed, however the sender.type of the RadComboBox is null. How do I get the type?

here is my javascript function:

function RefreshCsiOptions(sender) {
            switch (sender.type) {
                case "radio":
                    if (sender.checked == true) {
                        for (i = 0; i < cbxCSI.length; i++) {
                            var z = rcbCSI[i];
                            if (rcbCSI[i].get_selecteditem().get_value() != "") { rcbCSI[i].disabled = "disabled"; } else { cbxCSI[i].disabled = true; }
                            cbxCSI[i].checked = false;
                        }
                        lblWithoutCSI.disabled = "";
                    }
                    break;
                case "checkbox":
                    var cbxNumber = sender.id.substr(6, 1);
                    if (sender.checked == true) {
                        rcbCSI[cbxNumber - 1].disabled = "";
                        lblWithoutCSI.disabled = "disabled";
                        rbWITHOUT.checked = false;
                    } else {
                        rcbCSI[cbxNumber - 1].disabled = "disabled";
                    }
                    CheckWithoutStatus();
                    break;
                case "select-one":
                    var rcbNumber = sender.id.substr(14, 1);
                    if (rcbNumber == "_") rcbNumber = "0";
                    var rcbValue = rcbCSI[rcbNumber].get_selecteditem().get_value();
                    document.Form1.elements['CSI' + rcbNumber + '_value'].value = rcbValue;
                    if (rcbValue != "") {
                        cbxCSI[rcbNumber].disabled = false;
                        cbxCSI[rcbNumber].checked = true;
                        if (rbWITHOUT.checked == true) rbWITHOUT.checked = false;
                    } else {
                        cbxCSI[rcbNumber].disabled = true;
                        cbxCSI[rcbNumber].checked = false;
                        CheckWithoutStatus();
                    }
                    break;
                default:
                    //alert(sender.type);
                    break;
            }
        }  
Nencho
Telerik team
 answered on 09 Jul 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?