Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
118 views
is there a way to retrieve the item index from a RadGrid without going through a command item? What I need to accomplish is just for example (code below) but the ItemIndex always returns as 0 

Public Sub Test ()
For each item as GridDataItem in RadGrid1.Items
 
Dim i as integer = item.ItemIndex  ' (Item.ItemIndex always returns as 0 )
 
Next
 
End Sub

I certain this was working before , i need to identify if the code base was changed , but any help is appreciated 
Landon
Top achievements
Rank 2
 answered on 17 May 2011
5 answers
140 views
 

I have a datagrid that gets filled serverside with he DataSource.

When deleting a item I use the RadGrid1_DeleteCommand event and apply the following code to get the item I have to delete.

 

void RadGrid1_DeleteCommand(object sender, GridCommandEventArgs e)

{

GridEditableItem item = (GridEditableItem)e.Item;

dynamic DynamicBusinessObject = (item.OwnerTableView.DataSource as IEnumerable<dynamic>).ToList()[item.DataSetIndex];


This normally works great however when the user applies a filter to a column the DataSetIndex returns me the index-number of filtered page, not the corresponding index in the item.OwnerTableView.DataSource.

Much like ItemIndex will do when I’m on another page then page 1 within a grid.

How to get the corresponding item.OwnerTableView.DataSource index-number (or object) of the item.

Marin
Telerik team
 answered on 17 May 2011
2 answers
81 views
hi dear telerik team

At first look at the below aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm4.aspx.cs" Inherits="Amlak.WebForm4" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadComboBox1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="CheckBox1" UpdatePanelRenderMode="Inline" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadComboBox ID="RadComboBox1" runat="server" AutoPostBack="True" AppendDataBoundItems="True"
            OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged">
            <Items>
                <telerik:RadComboBoxItem runat="server" Text="1" Value="1" />
                <telerik:RadComboBoxItem runat="server" Text="2" Value="2" />
                <telerik:RadComboBoxItem runat="server" Text="3" Value="3" />
                <telerik:RadComboBoxItem runat="server" Text="4" Value="4" />
            </Items>
        </telerik:RadComboBox>
        <br />
        <br />
        <asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True" OnCheckedChanged="CheckBox1_CheckedChanged"
            Text="Check Me" TextAlign="Left" />
        <br />
        <br />
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    </div>
    </form>
</body>
</html>

My code behind is like this:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
namespace Amlak
{
    public partial class WebForm4 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
 
        }
 
        protected void RadComboBox1_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
        {
            if (RadComboBox1.SelectedItem.Value == "2")
            {
                CheckBox1.Checked = true;
            }
            else
            {
                CheckBox1.Checked = false;
            }
 
        }
 
        protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
        {
            if (CheckBox1.Checked)
            {
                TextBox1.Text = "text";
            }
            else
            {
                TextBox1.Text = "";
            }
        }
    }
}


My goals:


  1. I want to force RadComboBox1 to work in AJAX mode
    and change the CheckBox1.Checked by defined conditions in code behind.
    -> do not want postback for this.

  2. I want to force CheckBox1 to work in PostBack mode and change the TextBox1.text by defined conditions in code behind. -> I want postback for this.

In this scenario -> RadComboBox1 works fine
but I don't know why OnCheckedChanged="CheckBox1_CheckedChanged" does not fire when we change check of CheckBox1! (because we added it as update of RadComboBox1 In RadAjaxManager1).


My questions:

1-Should I add RadComboBox1 as update Of RadComboBox1 or not? However it works fine without adding this.

2-If we add ChechBox1 To RadAjaxManager1 like below:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm4.aspx.cs" Inherits="Amlak.WebForm4" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadComboBox1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="CheckBox1" UpdatePanelRenderMode="Inline" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="CheckBox1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="TextBox1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadComboBox ID="RadComboBox1" runat="server" AutoPostBack="True" AppendDataBoundItems="True"
            OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged">
            <Items>
                <telerik:RadComboBoxItem runat="server" Text="1" Value="1" />
                <telerik:RadComboBoxItem runat="server" Text="2" Value="2" />
                <telerik:RadComboBoxItem runat="server" Text="3" Value="3" />
                <telerik:RadComboBoxItem runat="server" Text="4" Value="4" />
            </Items>
        </telerik:RadComboBox>
        <br />
        <br />
        <asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True" OnCheckedChanged="CheckBox1_CheckedChanged"
            Text="Check Me" TextAlign="Left" />
        <br />
        <br />
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    </div>
    </form>
</body>
</html>

So it works fine in AJAX mode, but I want to force CheckBox1 to work in PostBack!
How can I fix this issue?

3-Should I add TextBox1 as update of RadComboBox1 in RadAjaxManager or not?

Thanks for attention to my question.
best regards


Majid Darab
Top achievements
Rank 1
 answered on 17 May 2011
1 answer
78 views
Hi,
below i wrote a code according to my condition with the Window.Confirm function.
this method is called on the RadButton  clientcliked event.
I want to know how same thing can be done with RadConfirm method.

 function rbReturnToData_Clicked(button, args) {
            debugger;                 
            var pending = document.getElementById("<%= lblChangesPending.ClientID %>");
            var lblTitleFilter = document.getElementById("<%= lblTitleFilter.ClientID %>");
            var rfGridFilter = document.getElementById("<%= rfGridFilter.ClientID %>");

            if (pending != null) {
              if (pending.innerHTML != "") {
                  if (window.confirm("You have pending filter changes.  Apply them?")) {
                     
                      button.set_commandName('Apply')                                                            
                      button.set_autoPostBack(true);
                    }
                    else {                       
                        button.set_commandName('Cancel')    
                        button.set_autoPostBack(true);                        
                    }
                }
                else
                    CollapseToolsPane();
            }
            else {
                CollapseToolsPane();
            }            
        }
Gimmik
Top achievements
Rank 1
 answered on 17 May 2011
1 answer
88 views
Hi,
I want to format a sql server float type value to the format: ###,###
How can I do this? 
I noticed that the format {0:c} doesn't work for float types and anyways I don't want any $ sign.
Any help would be appreciated.
As an example:

<radG:GridBoundColumn DataField="VarianceVal" UniqueName="VarianceVal" HeaderText="Value Variance Rule Result"
DataFormatString="{0:c}"></radG:GridBoundColumn>



										
Gimmik
Top achievements
Rank 1
 answered on 17 May 2011
2 answers
100 views
Hi
I've added this tag to a page :

 

 

        <telerik:RadScriptManager ID="RadSkinManager1" runat="server">
            <Scripts>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            </Scripts>
        </telerik:RadScriptManager>

 

 

 

 

 

 

 


but javascript intellisenes doesn't work
(I'm working with VS2010)
Please tell me wath should I do?
Thanks for your feedbacks
reza
Top achievements
Rank 1
 answered on 17 May 2011
8 answers
132 views
Hello

I want to modify the EditorDialogs that I can find here : C:\Program Files\Telerik\RadControls for ASP.NET AJAX Q2 2010\EditorDialogs
Specifically, I need to change the RadFileExplorer1.Configuration.ContentProviderTypeName in the FileBrowser dialog, so that when it looks for a file, it lists them from the database instead of from the file system.

So, I copied the ascx in the EditorDialogs folder of my project. It seems to work, because if I add "aaaa" in the control, for example, it shows in the resulting html.

However, no server side code seems to work, at all, ever, period. If I add server-side code, then add breakpoints, they do not load (can't reach breakpoint, symbols not loaded)
- I tried to add a Page_Load method : nothing happens, not even if I just try a simple "response.write".
- I tried "<%= "test" %>" somewhere in the usercontrol : nothing shows
- I switched the language of the controls to VB (my project is vb.net, but the controls are in c#), still no luck
- I re-created the control using a code-behind file, still nothing, with either vb or c#

So, any idea on how I can switch the ContentProvider of every FileBrowser of every RadEditor of the project ? (and there are a lot of editors in there...)

Thanks
Thomas B
Top achievements
Rank 1
 answered on 17 May 2011
2 answers
136 views
I have a RadWindow that is used as a dialog. The page in it has a couple of RadColorPickers in it.

When displayed, the colour pickers are always displayed relative to the picker button which causes scrollbars to appear in the dialog, regardless of the size of the window (See this Jing video for an example).

My mark-up looks something like this ...
<telerik:RadColorPicker id="ColBackColour" runat="server" ShowIcon="true" KeepInScreenBounds="true" ShowEmptyColor="false" AutoPostBack="false" PreviewColor="false" Columns="35">
  <telerik:ColorPickerItem title="Light Pink" value="#FFB6C1"/>
  <!-- blah -->
</telerik:RadColorPicker >

I note that whatever I do there is always item level CSS injected to set the top and left of the colour picker. I need to be able to override this to set the position relative to the dialog bounds.

-- 
Stuart


Stuart Hemming
Top achievements
Rank 2
 answered on 17 May 2011
3 answers
187 views
Hi,

How can I create a my own ImageManager? I find som information about the FileManager (Custom Dialog in the LinkManager).
but I will like to do that with the ImageManager.

I'st anyone out there that have a good advice or some examples to share?

Best regards

Rune



Rumen
Telerik team
 answered on 17 May 2011
1 answer
130 views
When will this product be available for purchase?
Sebastian
Telerik team
 answered on 17 May 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
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?