Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
246 views
Hi guys,

I currently have a RadGridView that populates data from a SQL database, i have added a 'telerik:GridTemplateColumn' with a Delete hyperlink inside of it.

<telerik:GridTemplateColumn UniqueName="TemplateDeleteColumn">
<ItemTemplate>
<asp:HyperLink ID="DeleteLink" runat="server" Text="Delete"></asp:HyperLink>
</ItemTemplate>
</telerik:GridTemplateColumn>

What happens is, when the gridView populates every row now has a delete link in it. How would i go about using C#  to delete that specific record from the SQL database
Princy
Top achievements
Rank 2
 answered on 29 Apr 2013
3 answers
507 views
We have the requirement that for a textbox with autocomplete functionality that submits when an asp button is clicked or the user presses enter while the textbox has focus (the use may have entered or selected from the dropdown).

We also need the AllowCustomEntry functionality that RadAutoCompleteBox supplies.

I cannot seem to find a solution in the Telerik tools:
-  RadAutoCompleteBox does not submit on enter. Via JQuery I was able to detect enter and run the click event for my button which submitted to the server ok but the text field for the RadAutoCompleteBox  was blank. When I added a focus event (for the button) before the click event my solution did work in Chrome but not in IE. 

- RadSearchBox. This control does submit on enter but it does not behave like a true text box. That is it does not display the value entered after the selection is made and does not seem to support an ASP button to kick off the search (this is part of the look and feel of our application). It also submits as soon as you select from the drop down which could be confusing for our users.

RADAutoCompleteBox is the closest solution but the fact that it does not post back to the server when enter is pressed is a show stopper for us. Apart from running the JQuery focus event prior to the button click event do you know of any other action I might take.

What I really would like is an autocomplete box that supported a 2 step process: the user selects the entry from the dropdrown which is displayed in the text box and then the user can either press enter or click on the search button to post the text back to the server.

I hope that this is not too much feedback and my questions are clear. Cheers
Peter
Top achievements
Rank 1
 answered on 28 Apr 2013
1 answer
155 views
Hello,

I have two RadListBoxes and a button in my page, my requirement is after clicking the button the selected items in RadListBox1 should move to RadListBox2.

<telerik:RadListBox ID="RadListBox1" Width="200px" Height="300px"
     SelectionMode="Multiple" runat="server"></telerik:RadListBox>
<telerik:RadListBox ID="RadListBox2" Width="300px" Height="300px" runat="server">
     </telerik:RadListBox>

void button1_Click(object sender, EventArgs e)
{
  foreach (RadListBoxItem selectedItem in RadListBox1.SelectedItems)
  {
     RadListBox2.Items.Add(
new RadListBoxItem(selectedItem.Text));
  }
}

My problem is every time I click the button its removing already present item in RadListBox2 and adding the the currently selected item of RadListBox1. I want it to append the item to the already existing items of RadListBox2.

Can anyone help me here please.

Thanks,
Saquib
Saquib
Top achievements
Rank 1
 answered on 28 Apr 2013
2 answers
208 views
I'm using the embedded skin "Office2010Black" for my RadGrid.  Everything looks and works great except the label "Page Size" color on the page panels is black. Which makes it almost invisible on the dark gray background. The actual page numbers and the page count and item count are all white on dark gray.  So those are fine.

I've tried setting forecolor to white in the PagerStyle and I've try specifying a CSS with color=white for PagerStyle too.  No help with either of hese.  I tried creating a custom skin based on Office2010Black, but got stuck when I couldn't get the page radcombobox to display correctly and gave that up.

I can't see where I might be affecting this, but I can't believe that there is this issue with this skin (I aslo had the same problem when I tried the "Black" embedded skin too. ).  Here's the mark-up code:

<telerik:RadGrid ID="rgLog" runat="server" ShowGroupPanel="False" AllowPaging="true"
     ItemStyle-BackColor="#ffe394" BackColor="White" Visible="true"
     Height="200" PageSize="25"
     Skin="Office2010Black" AllowSorting="true" AutoGenerateColumns="false" BorderWidth="0px"
     Width="1000" AllowCustomPaging="True"
     OnNeedDataSource="rgLog_NeedDataSource" OnItemDataBound="rgLog_ItemDataBound">
 
     <AlternatingItemStyle BackColor="White" />
     <ClientSettings AllowColumnHide="True" AllowColumnsReorder="True" AllowGroupExpandCollapse="True"
         ReorderColumnsOnClient="True" AllowDragToGroup="False">
         <Scrolling AllowScroll="False" UseStaticHeaders="True" />
         <Resizing AllowColumnResize="true" AllowRowResize="true" />
     </ClientSettings>
     <GroupingSettings ShowUnGroupButton="False" />
     <PagerStyle AlwaysVisible="true" Position="TopAndBottom" />
      
     <MasterTableView TableLayout="Fixed" CommandItemDisplay="Top">
         <NoRecordsTemplate>
             <br />
             No Records matched this search.<br />
             <br />
         </NoRecordsTemplate>
         <CommandItemSettings ShowExportToWordButton="false" ShowExportToExcelButton="false"
             ShowExportToCsvButton="true" ShowExportToPdfButton="false" ShowAddNewRecordButton="false" />
         <Columns>
             <telerik:GridTemplateColumn HeaderText="View Events" ItemStyle-HorizontalAlign="Center">
                 <ItemTemplate>
                     <a href="<%# GetURL( Eval("Number")) %>">
                         <img src='images/1258747021_old-edit-find.png' alt="View Detail" border="0" />
                     </a>
                 </ItemTemplate>
             </telerik:GridTemplateColumn>
             <telerik:GridTemplateColumn HeaderText="View Report" ItemStyle-HorizontalAlign="Center">
                 <ItemTemplate>
                     <a href="<%# GetChartURL( Eval("Number")) %>">
                         <img src='images/1259005159_pie_chart_search.png' width="24" alt="View Detail" border="0" />
                     </a>
                 </ItemTemplate>
             </telerik:GridTemplateColumn>
             <telerik:GridBoundColumn DataField="Number" Visible="false" />
             <telerik:GridBoundColumn DataField="Percent %" HeaderText="% of Total" ItemStyle-HorizontalAlign="Right"
                 DataFormatString="{0:p}" />
             <telerik:GridBoundColumn DataField="COUNT" HeaderText="Event Count" ItemStyle-HorizontalAlign="Right"
                 DataFormatString="{0:###,###,###}" />
         </Columns>
     </MasterTableView>
      
 </telerik:RadGrid>

Any help or suggestions on this are appreciated..
Hunter
Top achievements
Rank 1
 answered on 28 Apr 2013
0 answers
120 views
I have the following Column in my RadGrid,

<Telerik:DDLGridColumn UniqueName="ProductType"
                    Query="select Name AS ProductType, ID AS ProductTypeID From ProductTypes WHERE RetailerID={1}"
                    GetRetailerIDFromSession="True"
                    DataField="ProductType" DataValueField="ProductTypeID"
                    HeaderText="ProductType" SortExpression="ProductType">
                    <ItemTemplate>
                        <%# Eval("ProductType")%>
                    </ItemTemplate>
</Telerik:DDLGridColumn>

This is the code,

    
public class DDLGridColumn: GridTemplateColumn
    {
        protected override void SetupFilterControls(System.Web.UI.WebControls.TableCell cell)
        {
            RadComboBox rcBox = new RadComboBox();
            rcBox.ID = this.UniqueName + "_rcbox";
            rcBox.AutoPostBack = true;
            rcBox.DataTextField = this.DataField;
            rcBox.DataValueField = DataValueField ?? this.DataField;
            rcBox.SelectedIndexChanged += rcBox_SelectedIndexChanged;
            rcBox.Width = FilterControlWidth;
            string query = query = string.Format(this.Query, this.DataField);
            DataTable table = DBLayer.GetDataTable(query, CommandType.Text);
            DataRow row = table.NewRow();
            table.Rows.InsertAt(row, 0);
            rcBox.DataSource = table;
            cell.Controls.Add(rcBox);
        }
        private void rcBox_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
        {
            ((GridFilteringItem)(((RadComboBox)sender).Parent.Parent)).FireCommandEvent("Filter", new Pair());
        }
        protected override void SetCurrentFilterValueToControl(TableCell cell)
        {
            if (!(this.CurrentFilterValue == ""))
            {
                ((RadComboBox)cell.Controls[0]).Items.FindItemByValue(this.CurrentFilterValue).Selected = true;
            }
        }
        protected override string GetCurrentFilterValueFromControl(TableCell cell)
        {
            string currentValue = ((RadComboBox)cell.Controls[0]).SelectedItem.Value;
            this.CurrentFilterFunction = (currentValue != "") ? GridKnownFunction.EqualTo : GridKnownFunction.NoFilter;
            return currentValue;
        }
    }

I want the RadComboBox to filter with ID, but on UI it should show name. Is it possible
ABC
Top achievements
Rank 1
 asked on 28 Apr 2013
0 answers
80 views
Dear Telerik.
I am a beginner ASP.NET AJAX (Visual studio 2010 (4.0)).

 I want to Telerik help me code with '3 tier', use SQL Server (2008): same this website: http://demos.telerik.com/aspnet-ajax/carrental/

 However, my only concern is this part same bellow image:
Image 'snapshot_2013-04-28_144645.png'. Hover over a Item Car Product a tooltip appearance have any Information of that Item Car Product.

 And when click Item(a car product) appearance a window same bellow image:
Image link 'snapshot_2013-04-28_150445.png'

I don't need Tab 'Schedule & Reservation' only need Tab 'Information'.

If can, Telerik detailed instructions by "file.doc" step by step, I can learn.
Thank you Telerik.

Trân nhân
Top achievements
Rank 1
 asked on 28 Apr 2013
0 answers
140 views
Hi,
I have a combo box in edit mode of a telerik grid, but I am getting null value for selected value on onchange event. Please see code below

partail view:

 

 

Html.Telerik().ComboBox().Name("StyleImage").ClientEvents(events => events
.OnChange("onChange")
 )

here is js code

function onChange(e) {
    alert(e.value);
}

 here is grid onedit

function Grid_onEdit(e) {
           var styleImage = $('#StyleImage').data('tComboBox');
            $.getJSON(appUrl("Controller/Action"),
                { styleId: styleValue },
                function (data) {
                    styleImage.dataBind(data.value);
                    styleImage.value(e.dataItem['DefaultImage']);
                }
            );
        }
 
    }

 Here is controller code

public JsonResult Action(string styleId)
       {
          List<string> images=new List<string>();           
          return Json(new { success = true, value = images }, JsonRequestBehavior.AllowGet);
       }

this is how I am seeing rendered code for combo box
<div class="t-animation-container" style="width: 150px; height: 214px; position: absolute; z-index: 10002; top: 382.817px; left: 599.733px; display: none;">

<div class="t-popup t-group" style="display: block; height: auto; overflow: auto; width: 148px; margin-top: -214px;">
<ul class="t-reset">
<li class="t-item" unselectable="on">GWTUTU2-BRMLL</li>
<li class="t-item" unselectable="on">GWTUTU2-PIMLL</li>
<li class="t-item" unselectable="on">GWTUTU2-SILTX</li>
<li class="t-item t-state-selected" unselectable="on">GWTUTU2-BLMLL</li>
<li class="t-item" unselectable="on">GWTUTU2-YELLL</li>
<li class="t-item" unselectable="on">GWTUTU2-MPILL</li>
<li class="t-item" unselectable="on">GWTUTU2-DPILL</li>
<li class="t-item" unselectable="on">GWTUTU2-BUMLL</li>
<li class="t-item" unselectable="on">GWTUTU2-BLKLL</li>
<li class="t-item" unselectable="on">GWTUTU2-DGRLL</li>
</ul>
</div>
</div>



Thanks..
simmaneni
Top achievements
Rank 1
 asked on 28 Apr 2013
0 answers
131 views

I figured out how to set defaults for the multiple check boxes.

Here is my example:

DataTable tableMonths = new DataTable();
tableMonths.Columns.Add("name", typeof(int));
tableMonths.Columns.Add("value", typeof(string));
tableMonths.Rows.Add(12, "12");
tableMonths.Rows.Add(24, "24");
tableMonths.Rows.Add(36, "36");
tableMonths.Rows.Add(48, "48");
tableMonths.Rows.Add(60, "60");
tableMonths.Rows.Add(72, "72");
RadComboBoxMonths.DataSource = tableMonths;
RadComboBoxMonths.DataTextField = "name";
RadComboBoxMonths.DataValueField = "value";
RadComboBoxMonths.DataBind();
// preselect these terms by default
RadComboBoxMonths.SelectedValue = "12";
RadComboBoxItem twelveMonths = (RadComboBoxItem)RadComboBoxMonths.SelectedItem;
twelveMonths.Checked = true;
RadComboBoxMonths.SelectedValue = "24";
RadComboBoxItem twentyFourMonths = (RadComboBoxItem)RadComboBoxMonths.SelectedItem;
twentyFourMonths.Checked = true;
RadComboBoxMonths.SelectedValue = "36";
RadComboBoxItem thritySixMonths = (RadComboBoxItem)RadComboBoxMonths.SelectedItem;
thritySixMonths.Checked = true;
Mike
Top achievements
Rank 1
 asked on 27 Apr 2013
1 answer
66 views
Hi,
I am reading an excel spreadsheet and need to load a radgrid manually 1 row at at time.  Is there any good example code on how to programatically create radgrid headers and load data without using a datasource.

Thanks.
Jayesh Goyani
Top achievements
Rank 2
 answered on 26 Apr 2013
1 answer
90 views
HI,

I followed the code example from here: http://demos.telerik.com/aspnet-ajax/grid/examples/programming/alphabeticpaging/defaultvb.aspx?#qsf-demo-source

Now the Alpha paging works great but the numeric paging when I click on any page it comes completely balnk
When I click on enable sorting and click on it comes blank

Is there something missing in the demo site code
<%@ Page Title="" Language="VB" MasterPageFile="~/AdminPanel/Admin.master" AutoEventWireup="false" CodeFile="pager_test.aspx.vb" Inherits="AdminPanel_franchise_pager_test" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
 
 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadGrid2">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid2"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
  
    <br />
    <hr />
    <div style="border: 5px solid #eaf2fd; width: 95%;">
        <telerik:RadGrid ID="RadGrid2" DataSourceID="SqlDataSource2" AllowPaging="True" PageSize="5"
            runat="server" GridLines="None" Width="100%" AllowSorting="True"
            CellSpacing="0">
            <PagerStyle Mode="NextPrevAndNumeric" EnableSEOPaging="False"></PagerStyle>
            <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
            <ItemStyle HorizontalAlign="Center"></ItemStyle>
            <AlternatingItemStyle HorizontalAlign="Center"></AlternatingItemStyle>
            <MasterTableView CommandItemDisplay="Top">
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
 
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
 
<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column"
                    Created="True"></ExpandCollapseColumn>
 
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
 
<PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
                <CommandItemTemplate>
                    <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
                </CommandItemTemplate>
            </MasterTableView>
 
<FilterMenu EnableImageSprites="False"></FilterMenu>
        </telerik:RadGrid>
    </div>
    <br />
  
    <asp:SqlDataSource ID="SqlDataSource2" runat="server"  ConnectionString="<%$ ConnectionStrings:SQL %>"
         
        SelectCommand="SELECT [a], [b], [c], [d], [e] FROM [franchises] WHERE ([xyz] LIKE @xyz)">
        <SelectParameters>
            <asp:Parameter Name="xyz" Type="String" DefaultValue="%" />
        </SelectParameters>
    </asp:SqlDataSource>
 
</asp:Content>

Protected Sub RadGrid2_ItemCreated(ByVal sender As Object, ByVal e As GridItemEventArgs) Handles RadGrid2.ItemCreated
       If TypeOf e.Item Is GridCommandItem Then
           Dim commandItem As GridCommandItem = CType(e.Item, GridCommandItem)
           Dim container As PlaceHolder = commandItem.FindControl("PlaceHolder1")
 
           Dim i As Integer
           For i = 65 To 65 + 25
               Dim linkButton1 As New LinkButton
               Dim lc As New LiteralControl("  ")
               linkButton1.Text = "" + ChrW(i)
 
               linkButton1.CommandName = "alpha"
               linkButton1.CommandArgument = "" + ChrW(i)
 
               container.Controls.Add(linkButton1)
               container.Controls.Add(lc)
           Next i
 
           Dim lcLast As New LiteralControl(" ")
           container.Controls.Add(lcLast)
 
           Dim linkButtonAll As New LinkButton
           linkButtonAll.Text = "All"
           linkButtonAll.CommandName = "NoFilter"
           container.Controls.Add(linkButtonAll)
       End If
   End Sub
 
   Protected Sub RadGrid2_ItemCommand(ByVal source As Object, ByVal e As GridCommandEventArgs) Handles RadGrid2.ItemCommand
       Dim value As String = Nothing
       Select Case e.CommandName
           Case ("alpha")
               value = String.Format("{0}%", e.CommandArgument)
               Exit Select
           Case ("NoFilter")
               value = "%"
               Exit Select
       End Select
       SqlDataSource2.SelectParameters("xyz").DefaultValue = value
       RadGrid2.Rebind()
   End Sub

Pavlina
Telerik team
 answered on 26 Apr 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
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?