Telerik Forums
UI for ASP.NET AJAX Forum
6 answers
563 views
I am using inplace editing on a RadGrid that is built using a class file. Everything is working well except I am having an issue the SelectedIndexChanged event not firing when the grid is in edit mode. Any thoughts?

Column Definition:
GridDropDownColumn _ID = new GridDropDownColumn
                         {
                             DataField = "ID",
                             HeaderText = "ID",
                             UniqueName = "ID",
                             ListTextField = "ID",
                             ListValueField = "ID",
                             ListDataMember = "ID",
                             DropDownControlType = GridDropDownColumnControlType.RadComboBox,
                             HeaderStyle = { Width = Unit.Pixel(140) },
                             ItemStyle = { Width = Unit.Pixel(140) },
                             ReadOnly = false,
                             Display = true,
                         };
_reinsurerRadGrid.MasterTableView.Columns.Add(_ID);

UserControl Code:
private void RadGrid_ItemCreated(object sender, GridItemEventArgs e)
{
    if (e.Item is GridEditableItem && e.Item.IsInEditMode)
    {
        try
        {
            if ((e.Item as GridDataItem) == null) { return; }
            ((RadNumericTextBox) (e.Item as GridDataItem)["Percentage"].Controls[0]).Width = Unit.Pixel(75);
            ((TextBox) (e.Item as GridDataItem)["Code"].Controls[0]).Width = Unit.Pixel(75);
 
            RadComboBox _participantList = (e.Item as GridEditableItem)["ID"].Controls[0] as RadComboBox;
            if (null == _participantList) { return; }
 
            _participantList.Width = Unit.Pixel(120);
            _participantList.DataValueField = "ID";
            _participantList.DataTextField = "ID";
            _participantList.AutoPostBack = true;
            _participantList.DataSource = MAASBaseInterface.ParticipantAPI.GetParticipants();
            _participantList.DataBind();
            _participantList.SelectedIndexChanged += new RadComboBoxSelectedIndexChangedEventHandler(_participantList_SelectedIndexChanged);
 
            if (!(e.Item.DataItem is GridInsertionObject))
                _participantList.SelectedValue = ((Participant) (e.Item.DataItem)).ID.ToString();
            if (e.Item.DataItem is GridInsertionObject)
                _participantList.EmptyMessage = "-- Select --";
        }
        catch (Exception ex)
        {
 
            string _ex = ex.Message;
        }
    }
}
 
void _participantList_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
    //first reference the edited grid item through the NamingContainer attribute
    GridEditableItem editedItem = (sender as RadComboBox).NamingContainer as GridEditableItem;
    int _selectedValue = Convert.ToInt32((editedItem["ID"].Controls[0] as RadComboBox).SelectedValue);
    ParticipantList _participants = MAASBaseInterface.ParticipantAPI.GetParticipants();
    Participant _participant = _participants.Where(a => a.ID == _selectedValue) as Participant;
    RadTextBox _code = editedItem["Code"].Controls[0] as RadTextBox;
    _code.ReadOnly = false;
    _code.Text = _participant.Code;
}

Jaspal
Top achievements
Rank 1
 answered on 28 May 2015
33 answers
1.3K+ views
Hi Everybody!

I have a RadComboBox inside a RadGrid's GridTemplateColumn, and I'm having problems when trying to use the RadComboBox's SelectedIndexChanged event.

When the user is in Insert Mode, the event only fires after another control causes postback OR when he/she uses the Insert or Cancel commands. However, in Edit Mode there is NO problem at all.

I have tried declaring the event in design mode (aspx) and made some tests, and then declaring it in Codebehind and made another tests. I even have tried declaring it both ways at the same time, but the result is the same.

I'm wondering what could cause that behaviour, but I'm afraid I can't find any solution.

I would share with you some info, because I think one of these points could be the cause of the issue:
  • RadComboBox is multicolumn (2 columns)
  • RadComboBox is being filled in it's ItemsRequested event
  • The RadGrid, which contains the RadComboBox, is inside a RadAjaxPanel
  • RadGrid's MasterTableView EditMode Property is "PopUp"
  • Besides the RadGrid, there are a RadToolTipManager and a RadInputManager controls in the WebForm
  • The WebForm, which contains the RadGrid, belongs to a ContentPlaceHolder
  • I'm using RadGrid version 2009.2.286.20

I hope someboy can help me, or at least give me an idea to find a solution.

Please, if you consider that it is necessary watching the code I'm using, let me know!


Thanks for your attention!

Jaspal
Top achievements
Rank 1
 answered on 28 May 2015
1 answer
127 views

I am trying to use Batch edit mode in RadGrid. My problem is I need to display and edit different types of data in the same column of each row. I can query the data and set the Datasource of RadGrid programatically to display the data successfully. However, I don't know how to set the EditItemTemplate to let user edit the cell data depends on showing data type, eg. RadDropDownList for Status, RadTextBox for OrderNumber, RadNumericTextbox for Amount. My scenario is

Item          |     January    |  February    |    .....

---------------------------------------------------------- 

Status       |

Order#      |

Amount     |

What is the best way to implement this?

Thank you in advance.

Konstantin Dikov
Telerik team
 answered on 28 May 2015
4 answers
236 views

Hi,

I have a RadGrid with columns of type GridDateTimeColumn. This grid implements filtering.

What I need to do is very simple. I just would like to change the skin of the RadDatePicker. In fact, I would prefer not to specify a skin at all so that the default skin is used. The reason that I want the default (or no skin) is that it show's "today" at the bottom of the calendar and this would be very useful for our users.

At the moment I am playing around with using a FilterTemplate for these columns. However, I am running into some problems. So, before I go any further I am just wondering if there is an easier way to do this? Creating a FilterTemplate just for this (to make the today option appear) seems like a lot of work that might turn out to be unnecessary.

Please let me know.

Thanks,
John.

 

 

John
Top achievements
Rank 1
 answered on 28 May 2015
3 answers
116 views

I using Telerik for SharePoint on a page layout I am using the tag below

<telerik:RadHtmlField id="EnglishContent" FieldName="English Content" runat="server"> </telerik:RadHtmlField>

My customer requires to have a default text value inside this editor every time the user creates new page from the page layout. When I am trying to use rhe <content> tag I got an error that the tag content is not recognized as a Rad HTML Field tag.
Ianko
Telerik team
 answered on 28 May 2015
2 answers
118 views

I have a Radedior with rad window but editor tools are not working with in radwindow how to overcome this any suggestions .

 

Regards

SR.

SR
Top achievements
Rank 1
 answered on 28 May 2015
3 answers
244 views

Hi,

 Why I'm having 2 browses buttons by default? See attachment.

How can I display 1 browse button?

Thanx

 

<telerik:RadAsyncUpload runat="server" ID="RadAsyncUpload1" AllowedFileExtensions="jpg,jpeg,png,gif" Localization-DropZone=""> 
    </telerik:RadAsyncUpload>

Dimitar
Telerik team
 answered on 28 May 2015
1 answer
323 views

Hi,

I am trying to set RoundCorners for my ComboBox. here is my code and CSS and image

 ASPX

<telerik:RadComboBox ID="RadcFilter" AllowCustomText="false" Font-Size="10pt"  SelectOnTab="true" HighlightTemplatedItems="true" MarkFirstMatch="true" ChangeTextOnKeyBoardNavigation="false" OnClientKeyPressing="radComboKeyPress"  OnClientFocus="OnClientFocus"  Filter="StartsWith" Skin="Simple"  runat="server" Width="300px" Height="150px"   EmptyMessage="Filter By ..." AutoPostBack="true" >
</telerik:RadComboBox>

 

CSS

<style type="text/css">  
         
       html, body, form 
       
          height: 100%; 
          margin: 0px; 
          padding: 0px; 
       }
       div.RadComboBox_Simple,
       div.RadComboBox_Simple .rcbInput
       {
            
           line-height: 17px;
           
       }
       div.RadComboBox_Simple table tr td.rcbInputCell
       {
           height: 27px;
           line-height: 27px;
       }
       div.RadComboBox_Simple td.rcbArrowCell a
       {
           height: 27px;
       }
       div.RadComboBox_Simple table tr td.rcbArrowCell
       {
           background-image: url('images/rcbSimpleSprite.png');
           background-repeat: no-repeat;
           background-position: 0 50%;
       }
       div.RadComboBox_Simple td.rcbArrowCell { background-position: 0 50%; }
       div.RadComboBox_Simple .rcbHovered .rcbArrowCell { background-position: -20px 50%; }
       div.RadComboBox_Simple .rcbFocused .rcbArrowCell { background-position: -40px 50%; }
       div.RadComboBox_Simple .rcbDisabled .rcbArrowCell { background-position: -60px 50%; }
        
       div.RadComboBox_Simple table td.rcbInputCell
       {
           border-radius: 7px 0 0 7px !important;
           border : 1px solid gray;
       }
        
       div.RadComboBox_Simple table td.rcbArrowCell
       {
           border-radius:0 7px 7px 0 !important;
           border : 1px solid gray;
       }
</style>

 

JavaScript

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
 
       <script type="text/jscript">
               function radComboKeyPress(comboBox, eventArgs) {
 
               var keyCode = eventArgs.get_domEvent().keyCode;
               if (keyCode == 9) {
                   try {
                       comboBox.get_highlightedItem().select();
                   }
                   catch (err) {
                       return;
                   }
               }
           }
 
           function OnClientFocus(sender, args) {
               sender.showDropDown();
           }
</script>
 
</telerik:RadCodeBlock>

Dimitar
Telerik team
 answered on 28 May 2015
7 answers
172 views
Can someone tell me where I can find a list of supported file types for the media player?
Maria Ilieva
Telerik team
 answered on 28 May 2015
5 answers
167 views

Hi 

I have a SQLDatasource which uses a query to make a join across databases.  The data returned is should be used to create the bar chart.  However, no matter what I do, it fails to display anything.

 As a check that the sqldatasource is fetching the data, I'm also binding it to radgrid on the page.  The grid is working just fine and showing all the data.  However the chart shows nothing.

The main parts from my page:-

<p>
    <asp:DropDownList ID="PocList" runat="server" AutoPostBack="True" DataSourceID="LinqDataSource1" DataTextField="outlet_name" DataValueField="outlet_id"></asp:DropDownList>
</p>
 
<p>
    <asp:DropDownList ID="MonthList" runat="server" AutoPostBack="true">
        <asp:ListItem Value="1" Text="January"/>
        <asp:ListItem Value="2" Text="February"/>
        <asp:ListItem Value="3" Text="March"/>
        <asp:ListItem Value="4" Text="April"/>
        <asp:ListItem Value="5" Text="May"/>
        <asp:ListItem Value="6" Text="June"/>
        <asp:ListItem Value="7" Text="July"/>
        <asp:ListItem Value="8" Text="August"/>
        <asp:ListItem Value="9" Text="September"/>
        <asp:ListItem Value="10" Text="October"/>
        <asp:ListItem Value="11" Text="November"/>
        <asp:ListItem Value="12" Text="December"/>
    </asp:DropDownList>
</p>
 
<asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="WebApplication1.RewardsDataClassesDataContext" EntityTypeName="" OrderBy="outlet_name" Select="new (outlet_id, outlet_name)" TableName="outlet_accounts">
</asp:LinqDataSource>
 
<telerik:RadHtmlChart ID="PocChart" runat="server" DataSourceID="SqlDataSource1"  >
    <PlotArea>
        <Series>
            <telerik:ColumnSeries DataFieldY="totalValue">
                <TooltipsAppearance Color="White" DataFormatString="${0}"></TooltipsAppearance>
            </telerik:ColumnSeries>
        </Series>
        <XAxis DataLabelsField="brandname">
            <LabelsAppearance RotationAngle="75"/>
            <MajorGridLines Visible="false"/>
            <MinorGridLines Visible="false"/>
        </XAxis>
        <YAxis>
            <LabelsAppearance DataFormatString="${0}"></LabelsAppearance>
            <TitleAppearance Text="Total Points Value"></TitleAppearance>
            <MinorGridLines Visible="false"></MinorGridLines>
        </YAxis>
    </PlotArea>
</telerik:RadHtmlChart>
 
 
<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1" GroupPanelPosition="Top">
    <MasterTableView AutoGenerateColumns="False" DataSourceID="SqlDataSource1">
        <Columns>
            <telerik:GridBoundColumn DataField="month" DataType="System.Int32" FilterControlAltText="Filter month column" HeaderText="month" SortExpression="month" UniqueName="month">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="brand_id" DataType="System.Int32" FilterControlAltText="Filter brand_id column" HeaderText="brand_id" SortExpression="brand_id" UniqueName="brand_id">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="brandname" FilterControlAltText="Filter brandname column" HeaderText="brandname" SortExpression="brandname" UniqueName="brandname">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="value" DataType="System.Int32" FilterControlAltText="Filter value column" HeaderText="value" ReadOnly="True" SortExpression="value" UniqueName="value">
            </telerik:GridBoundColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>
 
 
 
 
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Appreciation_WarehouseConnectionString %>" SelectCommand="SELECT omba.month, omba.brand_id, bd.brand_name AS brandname, SUM(omba.total_value) AS totalValue FROM outlet_month_brand_aggregation AS omba INNER JOIN appreciation_rewards.dbo.brand AS bd ON omba.brand_id = bd.brand_id WHERE (omba.outlet_id = @oid) AND (omba.month = @month) GROUP BY omba.brand_id, omba.month, bd.brand_name ORDER BY omba.month, brandname">
    <SelectParameters>
        <asp:ControlParameter ControlID="PocList" DefaultValue="6782" Name="oid" PropertyName="SelectedValue" Type="Int32" />
        <asp:ControlParameter ControlID="MonthList" DefaultValue="1" Name="month" PropertyName="SelectedValue" Type="Int32" />
    </SelectParameters>
</asp:SqlDataSource>

Danail Vasilev
Telerik team
 answered on 28 May 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?