Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
37 views
Hi,
I would like to know if use of GridDragDropColumn is 508 compliant?
If not, I would appreciate if you can suggest the alternate way.
Manisha

Marin
Telerik team
 answered on 06 Dec 2012
1 answer
55 views
Hi,

I want to create my own expand/collapse functionallity for rad grid.
I have a GridImageButton column inside my grid with "+" button, and I want to chane it to "-" when the row is already expanded.
I tried to do it "OnItemCommand" event, but it doesn't fire.

Here is my code:

I create the grid inside a place holder on server side:

RadGrid grid = new RadGrid();

GridReport.ItemCommand += new GridCommandEventHandler(this.grid_ItemCommand);

GridPlaceHolder.Controls.Add(grid);


private void GridReport_ItemCommand(object source, GridCommandEventArgs e)

{

        if (e.CommandName == "Information")

         { 

                if (e.Item is GridDataItem)

                 {

                        GridColumnCollection gridColumns = e.Item.OwnerTableView.Columns;

                        GridDataItem myGridItem = (GridDataItem)e.Item;

 

                        if (gridColumns.FindByUniqueNameSafe("Information") != null)

                         {

                                ImageButton myRuleImageButton = (ImageButton)myGridItem["Information"].Controls[0];

                                 myRuleImageButton.ImageUrl =  "~/Images/Icons/collapse.png";

                         }

                 }

         }

}

 

private void GridReport_ItemDataBound(object sender, GridItemEventArgs e)

{

         if (e.Item is GridDataItem)

         {

                GridDataItem myGridItem = (GridDataItem)e.Item;

                if (gridColumns.FindByUniqueNameSafe("Information") != null)

                 {

 

                        ImageButton myRuleImageButton = (ImageButton)myGridItem["Information"].Controls[0];

                        myRuleImageButton.OnClientClick = String.Format("Click(" + myGridItem.ItemIndex + "); return true;");

                 }
        }

}

Column Creation:

buttonColumn = new GridButtonColumn();

buttonColumn.ItemStyle.BorderWidth = Unit.Pixel(0);

buttonColumn.CommandName = "Information";

buttonColumn.UniqueName = "Information";

buttonColumn.ButtonType = GridButtonColumnType.ImageButton;

buttonColumn.ImageUrl = "~/Images/Icons/expand.png";

buttonColumn.HeaderStyle.Width = Unit.Pixel(20);

buttonColumn.Resizable = false;

buttonColumn.Reorderable = false;

buttonColumn.Visible = true;

GridReport.MasterTableView.Columns.Add(buttonColumn);


     

Thanks!

Maria Ilieva
Telerik team
 answered on 06 Dec 2012
1 answer
98 views
Hi,

I want to bind telerik scheduler for  7 weekdays only with events, do not have datasource with date, just have time and day.

i have some events for each weekday that i want bind, i have time and day(like monday, tuesday,etc) that i want to bind with weekview of telerik scheduler.

see attached screen for my issue.

can anyone suggest how can i achieve this ?

Please help me quick.

Thank you.
Princy
Top achievements
Rank 2
 answered on 06 Dec 2012
1 answer
100 views
How do I clear the contents of a GridDropDownColumn (RadComboBox) which is bound to a EntityDataSource? 

The following code changes the data source of a cascading drop-down, but doesn't clear the contents of the RadComboBox - possibly because it's bound to the the EntityDataSource... (I hope to avoid doing a UNION NULL on the EntityDataSource).

protected void rgUnits_ItemCreated(object sender, GridItemEventArgs e)
       {
           GridEditableItem item = e.Item as GridEditableItem;
            
           if (item != null &&
               item.IsInEditMode &&
               item.OwnerTableView.DataSourceID != DataSourceIDUnitItem) // Parent Row
           {
               RadComboBox combo = (RadComboBox)item["EquipmentType"].Controls[0];
               combo.AllowCustomText = true;
               combo.AutoPostBack = true;
               combo.SelectedIndexChanged += combo_SelectedIndexChanged;
           }
       }
 
       void combo_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
       {
           GridEditableItem editedItem = (sender as RadComboBox).NamingContainer as GridEditableItem;
 
           int equipmentTypeID = 0;
           if (int.TryParse(((RadComboBox)editedItem["EquipmentType"].Controls[0]).SelectedValue, out equipmentTypeID))
           {
               EquipmentDescriptionDataSource.Where = string.Format(EquipmentDescriptionFilter, equipmentTypeID);
 
               RadComboBox rcbEquipmentDescription = ((RadComboBox)editedItem["EquipmentDescription"].Controls[0]);               
               rcbEquipmentDescription.DataBind();
               rcbEquipmentDescription.ClearSelection();
               rcbEquipmentDescription.Text = string.Empty;
           }
       }


Any thoughts?
Peter
Top achievements
Rank 1
 answered on 06 Dec 2012
1 answer
83 views

I have a Telerik Grid contains a template column, this column holds a RadGridList and receives its data from StringCollection, this means that I have a column with multiple values.

I'm trying to filter this column using a combobox, I can filter such columns but with only single data, but how to filter a column contains multiple data represented by StringCollection?

I Usually use this way to filter columns

<telerik:GridBoundColumn DataField="ExperienceLevel" HeaderButtonType="TextButton" HeaderText="Experience Level" SortExpression="ExperienceLevel" UniqueName="ExperienceLevel">
                      <FilterTemplate>
                          <telerik:RadComboBox ID="RadComboBoxExperienceLevel" runat="server" AppendDataBoundItems="true" DataSourceID="SqlDataSourceExperienceLevel" DataTextField="englishName" DataValueField="ExperienceLevelID" DropDownWidth="150" OnClientSelectedIndexChanged="ExperienceLevelIndexChanged" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("ExperienceLevel").CurrentFilterValue %>' Width="100">
                              <Items>
                                  <telerik:RadComboBoxItem Text="All" Value="" />
                              </Items>
                          </telerik:RadComboBox>
                          <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
                              <script type="text/javascript">
 
                                  function ExperienceLevelIndexChanged(sender, args) {
                                      var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                      tableView.filter("ExperienceLevel", args.get_item().get_value(), "EqualTo");
                                  }
                              </script>
                          </telerik:RadScriptBlock>
                      </FilterTemplate>
                  </telerik:GridBoundColumn>
Daniel
Telerik team
 answered on 06 Dec 2012
1 answer
38 views

Team Telerik,

 

I think I have discovered a bug.

Recreation Steps:

 

  1. Ensure that AJAX is turned OFF.
  2. In any given RadGrid, create two or more GridNumericColumns.
  3. Drag a GridNumericColumnEditor to the design surface and configure it however you want.
  4. Set all of the GridNumericColumns in the RadGrid to use the GridNumericColumnEditor above as their "ColumnEditorID" property.
  5. Run the form and try to insert a new record. You'll get an error that says "The property is outside the range of valid values".

 

Background:

 

I am building a page that uses several numeric columns that should all be formatted in exactly the same way. So logically, I drag one GridNumericColumnEditor to the design surface, set its properties there, and then set all of the GridNumericColumns that should be formatted that way to use that column editor. Obviously, this doesn't work, even though you can do this with other ColumnEditors for other column types.

Workaround:

Use a different GridNumericColumnEditor for each of the GridNumericColumns - even if they're all to be formatted in exactly the same way. Clearly, this isn't very efficient, but it'll have to do for now until you guys can address this.

Telerik Version: 2012.3.1016.40 (2012 Q3)

Thanks in advance for your kind attention to this matter - and keep up the great work, you guys.

Regards,
Jonathan

Andrey
Telerik team
 answered on 06 Dec 2012
1 answer
120 views
hello
i have 4 main control, a radcombobox, radlistview with a asp button, and a label, i want to filter radlistview data by radcombobox selected value,( i do it without  problem), and after click on asp button in radlistview, that return datakey with button commandargument value to label, but my problem is after click on asp button, label show nothing.
RadComboBox code:
aspx:
<telerik:RadComboBox ID="CityDDL" runat="server"
     AutoPostBack="true" Label="City :" Skin="Default" />
cs:
protected void LoadCities()
{
    SqlConnection connection = new SqlConnection(
    ConfigurationManager.ConnectionStrings["SiteSqlServer1"].ConnectionString);
     SqlDataAdapter adapter = new SqlDataAdapter(@"", connection);
    DataTable dt = new DataTable();
    adapter.Fill(dt);
     CityDDL.DataTextField = "Name";
    CityDDL.DataValueField = "ID";
    CityDDL.DataSource = dt;
    CityDDL.DataBind();
    // Insert the first item.
    CityDDL.Items.Insert(0, new RadComboBoxItem("- Select City -"));
}

RadListView Code:
aspx:
<telerik:RadListView ID="RadListView1" runat="server" DataSourceID="SqlDataSource1"
    ItemPlaceholderID="ListViewContainer" AllowPaging="True" PageSize="12"
        onprerender="RadListView1_PreRender">
    <LayoutTemplate>                    
               <asp:PlaceHolder runat="server" id="ListViewContainer" />
    </LayoutTemplate>
    <ItemTemplate>
        <fieldset style="float: left; width: 266px; height: 260px;">
            <legend><b>State Name:</b>: <%#Eval("Name")%></legend>
            <div class="details">                           
                            <asp:Button ID="SelectStateID" OnClick="SelectStateID_Click"
CommandArgument='<%# Eval("ID") %>' runat="server" Text="Select State"  />
                <div class="data-container">
                    <ul>
                        <li>
                            <label>
                                State Code:
                            <%#Eval("Code")%>                          
                        </li>                       
                    </ul>                                        
                </div>
            </div>
        </fieldset>
    </ItemTemplate>
</telerik:RadListView>

cs:
protected void RadListView1_PreRender(object sender, EventArgs e)
{
    foreach (RadListViewItem item in RadListView1.Items)
    {
        Button lnk = item.FindControl("SelectStateID") as Button;
        RadAjaxManager1.AjaxSettings.AddAjaxSetting(lnk, Label1);
    }
}

ASP Button Code:
cs:
protected void SelectStateID_Click(object sender, EventArgs e)
{   
    var argument = ((Button)sender).CommandArgument;
    Label1.Text = argument.ToString();
}

RadAjaxManager Code:
aspx:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
         <AjaxSettings>
             <telerik:AjaxSetting AjaxControlID="CityDDL" EventName="SelectedIndexChanged">
                 <UpdatedControls>
                     <telerik:AjaxUpdatedControl ControlID="RadListView1" />
                 </UpdatedControls>
             </telerik:AjaxSetting>
         <telerik:AjaxSetting AjaxControlID="SelectStateID" EventName="SelectStateID_Click">
                 <UpdatedControls>
                     <telerik:AjaxUpdatedControl ControlID="Label1" />                                       
                 </UpdatedControls>
             </telerik:AjaxSetting>
        </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
            <asp:Image ID="Image1" runat="server" ImageUrl="~/images/WebResource.axd.gif" AlternateText="Loading..." />
        </telerik:RadAjaxLoadingPanel>

ASP Label:
aspx:
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>

please help me.
thanks
Andrey
Telerik team
 answered on 06 Dec 2012
5 answers
556 views
Hi,

I installed the "RadControls for ASP.NET AJAX Q3 2012". I am using sharepoint 2010. I added the Rad grid in the visual webpart and bound the columns.  I used the below code:
<telerik:RadGrid ID="RadGrid1" runat="server" Visible="true" ShowHeader="true" ShowFooter="true" >
    <MasterTableView DataKeyNames="Title" AutoGenerateColumns="false">
                    <Columns>
                        <telerik:GridBoundColumn DataField="Title" HeaderText="Product Number" UniqueName="ProductNumber">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Description" HeaderText="Description" UniqueName="Description">
                        </telerik:GridBoundColumn>
  </Columns>
    </MasterTableView>
    </telerik:RadGrid>
I am able to bind the existing data in the databind code using c#. Few questions:
1) How to insert new data?
2) Also above the header and below the footer, is it possible to add a option as "Add new item" clicking on this, the textbox within the grid become editable?
3) Limit the number of items which can be added in the grid to 5.

How to achieve this?
Thanks
Andrey
Telerik team
 answered on 06 Dec 2012
1 answer
79 views
Hi,

I am attaching a Contextmenu to Listview. This is 2 level composite Context menu (contextmenu.jpg). Below is my source for building Contextmenu

<telerik:RadContextMenu ID="RadMenu1" runat="server" EnableRoundedCorners="true" EnableShadows="true" OnClientShowing="LoadContextMenu">
           <Items>
               <telerik:RadMenuItem Text="Accounting">
                   <Items>
                       <telerik:RadMenuItem Text="Sub Menu">
                           <ItemTemplate>
                               <telerik:RadTextBox ID="txtDecimal" Text="2" Label="Decimals" runat="server" Width="70px"
                                   MaxLength="2">
                               </telerik:RadTextBox>
                               <telerik:RadListBox ID="rlbcm1" runat="server" CheckBoxes="true">
                                   <Items>
                                       <telerik:RadListBoxItem Text="Include Commas" Value="Include Commas" />
                                       <telerik:RadListBoxItem Text="Include $ Sign" Value="Include $ Sign" />
                                   </Items>
                               </telerik:RadListBox>
                               <b>Negative Number</b>
                               <asp:RadioButtonList ID="rbNegativeNumber" runat="server" RepeatDirection="Vertical">
                                   <asp:ListItem Text="Use Brackets" Value="1"></asp:ListItem>
                                   <asp:ListItem Text="Use Negative Number" Value="2"></asp:ListItem>
                               </asp:RadioButtonList>
                           </ItemTemplate>
                       </telerik:RadMenuItem>
                   </Items>
               </telerik:RadMenuItem>
               <telerik:RadMenuItem Text="Date">
                   <Items>
                       <telerik:RadMenuItem Text="Sub Menu">
                           <ItemTemplate>
                               <asp:RadioButtonList ID="rbDateFormat" runat="server" RepeatDirection="Vertical">
                                   <asp:ListItem Text="01/05/2012" Value="1"></asp:ListItem>
                                   <asp:ListItem Text="Jan 05, 2012" Value="2"></asp:ListItem>
                                   <asp:ListItem Text="2012-01-05" Value="3"></asp:ListItem>
                                   <asp:ListItem Text="Custom" Value="4"></asp:ListItem>
                               </asp:RadioButtonList>
                           </ItemTemplate>
                       </telerik:RadMenuItem>
                   </Items>
               </telerik:RadMenuItem>
               <telerik:RadMenuItem Text="Percentage">
                   <Items>
                       <telerik:RadMenuItem Text="Sub Menu">
                           <ItemTemplate>
                               <telerik:RadTextBox ID="txtPercentageDecimal" Text="2" Label="Decimals" runat="server"
                                   Width="70px" MaxLength="2">
                               </telerik:RadTextBox>
                               <telerik:RadListBox ID="rlbpercentage" runat="server" CheckBoxes="true">
                                   <Items>
                                       <telerik:RadListBoxItem Text="% symbol" Value="% symbol" />
                                   </Items>
                               </telerik:RadListBox>
                           </ItemTemplate>
                       </telerik:RadMenuItem>
                   </Items>
               </telerik:RadMenuItem>
               <telerik:RadMenuItem Text="Text">
                   <Items>
                       <telerik:RadMenuItem Text="Sub Menu">
                           <ItemTemplate>
                               <asp:RadioButtonList ID="rbText" runat="server" RepeatDirection="Vertical">
                                   <asp:ListItem Text="Case as input" Value="1"></asp:ListItem>
                                   <asp:ListItem Text="All Caps" Value="2"></asp:ListItem>
                               </asp:RadioButtonList>
                           </ItemTemplate>
                       </telerik:RadMenuItem>
                   </Items>
               </telerik:RadMenuItem>
           </Items>          
       </telerik:RadContextMenu>
   </div>
   <telerik:RadAjaxManager ID="RadAjaxManager" runat="server" OnAjaxRequest="RadAjaxManager_AjaxRequest">
       <AjaxSettings>
           <telerik:AjaxSetting AjaxControlID="RadAjaxManager">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="RadMenu1" LoadingPanelID="RadAjaxLoadingPanel" />
               </UpdatedControls>
           </telerik:AjaxSetting>
       </AjaxSettings>
   </telerik:RadAjaxManager>
   <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel" runat="server" Skin="Vista">      
   </telerik:RadAjaxLoadingPanel>

As you can see I have composite contextmenu which contains various server controls inside it (i.e Textbox, Listbox, Radiobutton).

Now I want to populate these contextmenu control with the dynamic values based on right clicked listview item. So for that I am performing an OnAjaxRequest="RadAjaxManager_AjaxRequest" request on OnClientShowing="LoadContextMenu" client event of Contextmenu.

Now the issue is that OnClientShowing event it is going to RadAjaxManager_AjaxRequest server request & performing all the server side update on context menu.
But the contextmenu is not repainted at clientside. i.e After server side processing, it is not showing on browser.
function LoadContextMenu(menu, args) {
                if (listItemIndex) {
                    InitiateAsyncRequest(listItemIndex);
                }
            }
 
function InitiateAsyncRequest(argument) {
                var ajaxManager = $find("<%= RadAjaxManager.ClientID %>");
                ajaxManager.ajaxRequest(argument);
                return false;
            }

Can you please help me how to reshow / repaint the contextmenu after AjaxRequest is performed.
Navnit
Top achievements
Rank 1
 answered on 06 Dec 2012
3 answers
232 views
Hello,

I am facing lot of problem creating GridTemplateColumn dynamically, i tried it using implementing ITemplate interface but was not successful.

I have other columns too in grid, which i create dynamically and do databinding also dynamically which works perfect,

Please can someone help me through this, its urgent.

Thanks in advance!

with regards,
Peeyush pandey
<telerik:GridTemplateColumn AllowFiltering="False" UniqueName="columnAction"  >
    <HeaderStyle Width="30px" />
    <HeaderTemplate>
        <asp:Label ID="lblHeaderAction" runat="server" Text="Action"></asp:Label>
    </HeaderTemplate>
    <ItemTemplate>
        <asp:Panel ID="editButtonPanel" runat="server" CssClass="custom-Action-column" Width="50px">
            <asp:ImageButton ID="TagCloudButton" runat="server"  Width="15px"
                Height="15px" CommandName="TagCloud"   CausesValidation="False" ImageUrl="~/images/icon_grid.gif" />
        </asp:Panel>
    </ItemTemplate>
</telerik:GridTemplateColumn>
 
 
 <telerik:GridTemplateColumn AllowFiltering="False" UniqueName="ProfileImage"  >
    <HeaderStyle Width="50px" />
    <HeaderTemplate>
        <asp:Label ID="lblHeaderActionImage" runat="server" Text="Image"></asp:Label>
    </HeaderTemplate>
    <ItemTemplate>
     <asp:Panel ID="ImagePanelPos" runat="server" CssClass="custom-Action-column" Width="50px">
        <asp:Image ID="Image1" runat="server" Height="35px" Width="35px" ImageUrl='<%#Convert.ToString(Eval("Url")) %>' />
        </asp:Panel>
    </ItemTemplate>
</telerik:GridTemplateColumn>
 
Shinu
Top achievements
Rank 2
 answered on 06 Dec 2012
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?