Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
145 views

we are using radGrid and having details table inside master table view  and an event onneeddatasource and checkbox column onside of radgrid and i want to export only selected row to excel..but the problem is that it is exporting all record to excell sheet beside selection of rows please help me ????????????????????????????
Shinu
Top achievements
Rank 2
 answered on 19 Mar 2012
3 answers
231 views
Ok, I have a grid with a couple of dropdownlist.  I have been able to populate them but what I cannot seem to get is to load the correct value from the database into the DDL on time of grid binding.  Right now the ddl's populate with all the first value and I want to populate them with the value from the DB.  I tried binding but does not seem to work.

<ItemTemplate>
                                    <asp:DropDownList ID="ddlFUndCode" runat="server" DataValueField='<%# Bind("intFundCodeId") %>'></asp:DropDownList>
                                </ItemTemplate>

<Columns>
                             <telerik:GridTemplateColumn HeaderText="PO NUM">
                                <ItemTemplate>
                                    <asp:TextBox ID="txtPONum" runat="server" Text='<%# Bind("strPoNum") %>'></asp:TextBox>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridDropDownColumn DataField="intMakeId" UniqueName="Make"></telerik:GridDropDownColumn>
                            <telerik:GridTemplateColumn HeaderText="MAKE">
                                <ItemTemplate>
                                    <asp:DropDownList ID="ddlmake" runat="server"></asp:DropDownList>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn HeaderText="COST">
                                <ItemTemplate>
                                    <asp:TextBox ID="txtCost" runat="server" Text='<%# Bind("fltCost") %>'></asp:TextBox>
                                    <asp:FilteredTextBoxExtender ID="txtCost_FTE" runat="server" Enabled="True" TargetControlID="txtCost" ValidChars="." FilterType="Custom, Numbers" />
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn HeaderText="FUND CODE">
                                <ItemTemplate>
                                    <asp:DropDownList ID="ddlFUndCode" runat="server" DataValueField='<%# Bind("intFundCodeId") %>'></asp:DropDownList>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn HeaderText="ASSET TAG">
                                <ItemTemplate>
                                    <asp:TextBox ID="txtAssetNum" runat="server" Text='<%# Bind("strAssetNum") %>'></asp:TextBox>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn HeaderText="SN">
                                <ItemTemplate>
                                    <asp:TextBox ID="txtSN" runat="server" Text='<%# Bind("strSn") %>'></asp:TextBox>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                        </Columns>
  
  
 Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            myRadGrid.DataBind()
        End If
    End Sub
  
    Protected Sub myRadGrid_ItemDataBound(sender As Object, e As Telerik.Web.UI.GridItemEventArgs) Handles myRadGrid.ItemDataBound
        If (TypeOf e.Item Is GridDataItem) Then
            Dim make As DropDownList = e.Item.FindControl("ddlmake")
            Dim Code As DropDownList = e.Item.FindControl("ddlFUndCode")
  
            sql = "Select intMakeId, strmake from tblmake"
            buildDD(sql, make)
  
            sql = "Select intFundCodeId, Cast(intCodeNUm as varchar) + ' \ ' + strDescription from tblFundCodes"
            buildDD(sql, Code)
  
        End If
    End Sub
  
    Protected Sub myRadGrid_NeedDataSource(sender As Object, e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles myRadGrid.NeedDataSource
        sql = "Select intRecId, strPoNum, intMakeId, fltCost, intFundCodeId, strAssetNum, strSn From tblReceived"
  
        myRadGrid.DataSource = getData(sql)
  
    End Sub
Shinu
Top achievements
Rank 2
 answered on 19 Mar 2012
6 answers
225 views
Hello.  I'm having problems with the rad grid latest demo and server side row selection.  My events are properly picked up from the checkbox clicks but they don't stay checked.  Even the demo code isn't working.  This code has been placed inside a SalesLogix CRM page.  All other functions appear to be working properly (sorting, filtering, binding, etc).  I've tried this both inside and outisde the UpdatePanel.  Am I doing something wrong here?  There is already an ASP script manager on the page hence the use of a proxy. Help appreciated!

Managers
<telerik:RadAjaxManagerProxy ID="RadAM" runat="server">
  <AjaxSettings>
    <telerik:AjaxSetting AjaxControlID="LDCAccounts">
      <UpdatedControls>
        <telerik:AjaxUpdatedControl ControlID="LDCAccounts" LoadingPanelID="RadAjaxLoadingPanel1" />
      </UpdatedControls>
    </telerik:AjaxSetting>
    <telerik:AjaxSetting AjaxControlID="RadGrid1">
      <UpdatedControls>
          <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
          <telerik:AjaxUpdatedControl ControlID="Literal1" />
      </UpdatedControls>
    </telerik:AjaxSetting>
  </AjaxSettings>
</telerik:RadAjaxManagerProxy>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />

Markup
<asp:UpdatePanel ID="ldcAccountPanel" runat="server">
  <Triggers>
    <asp:AsyncPostBackTrigger ControlID="Accounts" />
    <asp:AsyncPostBackTrigger ControlID="RadGrid1" />
  </Triggers>
  <ContentTemplate>
 
  <telerik:RadGrid ID="Accounts" Width="97%" AllowSorting="true" runat="server" PageSize="20"
    AllowMultiRowSelection="true" AllowFilteringByColumn="true" EnableLinqExpressions="true" AllowAutomaticInserts="false"
    OnInsertCommand="Accounts_RowAdding" OnNeedDataSource="Accounts_NeedData">
    <MasterTableView Width="100%" Summary="Rad!" AutoGenerateColumns="false"
      AllowFilteringByColumn="true" CommandItemDisplay="Top" EditMode="InPlace" ClientDataKeyNames="Id,AccountNumber">
      <CommandItemSettings ShowAddNewRecordButton="true" AddNewRecordText="Add" />
      <Columns>
        <telerik:GridButtonColumn Text="Select" CommandName="Select />
        <telerik:GridButtonColumn Text="Deselect" CommandName="Deselect" />
        <telerik:GridTemplateColumn UniqueName="ChkColumn">
          <HeaderTemplate>
            <asp:CheckBox ID="ChkAll" runat="server" OnCheckedChanged="Accounts_ToggleAll" AutoPostBack="true" />
          </HeaderTemplate>
          <ItemTemplate>
            <asp:CheckBox ID="ChkOne" runat="server" OnCheckedChanged="Accounts_ToggleRow" AutoPostBack="false" />
          </ItemTemplate>
        </telerik:GridTemplateColumn>
        <telerik:GridEditCommandColumn ButtonType="ImageButton" />
        <telerik:GridBoundColumn DataField="Id" Visible="true" HeaderText="PK" ReadOnly="true" />
        <telerik:GridBoundColumn DataField="Name" HeaderText="Name" CurrentFilterFunction="EqualTo" AutoPostBackOnFilter="true" />
        <telerik:GridBoundColumn Datafield="AccountNumber" HeaderText ="Account #" DataType="System.String" />
        <telerik:GridBoundColumn Datafield="Address1" HeaderText = "Address1" />
        <telerik:GridBoundColumn Datafield="Address2" HeaderText = "Address2" />
        <telerik:GridBoundColumn Datafield="City"  HeaderText = "City" DataType="System.String" />
        <telerik:GridBoundColumn Datafield="State"  headertext = "State" />
        <telerik:GridBoundColumn Datafield="Postalcode" headertext = "Zip" />
      </Columns>
    </MasterTableView>
    <ClientSettings EnableRowHoverStyle="true" />
    <PagerStyle Mode="NextPrevAndNumeric" />
  </telerik:RadGrid>
 
  <asp:CheckBox ID="ChkTest" runat="server" OnCheckedChanged="ChkTest_Click" AutoPostBack="true" />
  <asp:Button ID="Test" runat="server" OnClick="Accounts_Test" />
 
   
 
  <asp:Literal ID="Literal1" runat="server" />
 
  <telerik:RadGrid id="RadGrid1" OnItemCreated="RadGrid1_ItemCreated" OnPreRender="RadGrid1_PreRender"
   ShowStatusBar="true" runat="server" OnNeedDataSource="RadGrid1_NeedData" AllowPaging="True" AllowSorting="True"
    AllowMultiRowSelection="True">
    <MasterTableView PageSize="10">
        <Columns>
            <telerik:GridButtonColumn Text="Select" CommandName="Select">
            </telerik:GridButtonColumn>
            <telerik:GridButtonColumn Text="Deselect" CommandName="Deselect">
            </telerik:GridButtonColumn>
            <telerik:GridTemplateColumn UniqueName="CheckBoxTemplateColumn">
                <HeaderTemplate>
                 <asp:CheckBox id="headerChkbox" OnCheckedChanged="ToggleSelectedState" AutoPostBack="True" runat="server"></asp:CheckBox>
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:CheckBox id="CheckBox1" OnCheckedChanged="ToggleRowSelection" AutoPostBack="True" runat="server"></asp:CheckBox>
                </ItemTemplate>
            </telerik:GridTemplateColumn>
        </Columns>
    </MasterTableView>
    <ClientSettings EnableRowHoverStyle="true" />
    <PagerStyle Mode="NumericPages"></PagerStyle>
  </telerik:RadGrid>
 
  </ContentTemplate>
</asp:UpdatePanel>

Codebehind
protected void RadGrid1_NeedData(object sender, GridNeedDataSourceEventArgs e)
{
  RadGrid1.DataSource = CurrentOpportunity.SEChannelPartners;
}
 
protected void ToggleRowSelection(object sender, EventArgs e)
{
  ((sender as CheckBox).NamingContainer as GridItem).Selected = (sender as CheckBox).Checked;
}
 
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
  if (e.Item is GridDataItem)
  {
    e.Item.PreRender += new EventHandler(RadGrid1_ItemPreRender);
  }
}
 
private void RadGrid1_ItemPreRender(object sender, EventArgs e)
{
  ((sender as GridDataItem)["CheckBoxTemplateColumn"].FindControl("CheckBox1") as CheckBox).Checked = (sender as GridDataItem).Selected;
}
 
protected void ToggleSelectedState(object sender, EventArgs e)
{
  CheckBox headerCheckBox = (sender as CheckBox);
  foreach (GridDataItem dataItem in RadGrid1.MasterTableView.Items)
  {
    (dataItem.FindControl("CheckBox1") as CheckBox).Checked = headerCheckBox.Checked;
    dataItem.Selected = headerCheckBox.Checked;
  }
}
 
protected void Page_PreRender(object sender, EventArgs e)
{
  Literal1.Text = String.Format("<h3 class=\"qsfSubtitle\">Selected rows count is: {0}</h3>", RadGrid1.SelectedItems.Count);
}
 
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
  RadGrid1.DataSource = (ICollection<MyAccountClass>)GetAccounts();
  RadGrid1.DataBind();
  GridHeaderItem headerItem = RadGrid1.MasterTableView.GetItems(GridItemType.Header)[0] as GridHeaderItem;
  (headerItem.FindControl("headerChkbox") as CheckBox).Checked = RadGrid1.SelectedItems.Count == RadGrid1.Items.Count;
}
Tsvetina
Telerik team
 answered on 19 Mar 2012
1 answer
183 views
Hi!

I'm new to the Telerik tool and are for the moment evaluating it against Selenium webdriver.
But I have come across a problem where I need some help.

I'm trying to write a test for typeahead but are having problem with focus when I run the test on a testserver.

If I set the text directly I will not be able to validate the typeahead.
textBox.Text = "some text";

(textBox is here an HtmlInputText)

If I use the keyboard, I will be able to validate it, but if I run the test on for example a testserver (or if I minimize the browser) it doesn't work.

textBox.Focus();
textBox.Click();
var desktop = new Desktop();
var keyb = new KeyBoard(desktop);
keyb.TypeText("some text");
keyb.KeyPress(Keys.Tab);

Is there any other way to do this so I don't need to have focus on the browser?

Regards,
Milena
Telerik team
 answered on 19 Mar 2012
1 answer
247 views
Hi

I am using the Telerik Radgrid with radiobuttonlist as shown in following code
My problem is I am not able to find the radibutto list is checked or not at client sid when I validate the data (case:at least one radion button should be checked)

Please send me some clue.


<telerik:RadGrid ID="RadGrid1" runat="server" BackColor="#eeeeee" AutoGenerateColumns="false"
BorderWidth="0px" GridLines="None" Skin="" Width="450px" OnItemDataBound="RadGrid1_ItemDataBound">
 <%-- <ItemStyle CssClass="RowColor" />--%>
 <HeaderStyle Height="25px" />
 <MasterTableView Font-Names="Arial" Font-Size="8pt">
  <Columns>
<telerik:GridTemplateColumn HeaderText="Date" UniqueName="Date">
<ItemTemplate>
<asp:Label ID="lblODDate" runat="server" Text='<%# Eval("AttendanceDate", "{0:dd MMM yyyy}") %>'></asp:Label>
 </ItemTemplate>
<HeaderStyle HorizontalAlign="Center" Width="80px" />
<ItemStyle HorizontalAlign="Center" Width="80px" />
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Day" UniqueName="Day">
<ItemTemplate>
<asp:Label ID="lblODDay" runat="server" Text='<%# Eval("AttendanceDate", "{0:dddd}") %>'></asp:Label>
 </ItemTemplate>
<HeaderStyle HorizontalAlign="Center" Width="50px" />
<ItemStyle HorizontalAlign="Center" Width="50px" />
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Shift" UniqueName="Shift">
<ItemTemplate>
<asp:Label ID="lblShiftCode" runat="server" Text='<%# Bind("ShiftCode") %>'></asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center" Width="50px" />
<ItemStyle HorizontalAlign="Center" Width="50px" />
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Hrs" UniqueName="Hrs">
 <ItemTemplate>
<table cellpadding="0" cellspacing="0" width="250px">
<tr>
 <td align="left">
  <asp:RadioButtonList ID="rbtnOdDay" runat="server" RepeatColumns="3" RepeatDirection="Horizontal"
CssClass="textStyle1" Width="200px" RepeatLayout="Table">
 <asp:ListItem Text="Full Day" Value="1"></asp:ListItem>
<asp:ListItem Text="Half Day" Value="0.5"></asp:ListItem>
<asp:ListItem Text="Hours" Value="0"></asp:ListItem>
 </asp:RadioButtonList>
</td>
 <td id="trHrs" align="left" style="display: none" runat="server">
 <telerik:RadTimePicker ID="radTimePicker" runat="server" Width="35px" EnableTheming="true"
SkinID="ESSTimePicker">
</telerik:RadTimePicker>
   <%-- <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Please Select hrs."
Text="*" ControlToValidate="radTimePicker" ValidationGroup="mygroup" Display="Dynamic"></asp:RequiredFieldValidator>--%>
 </td>
   </tr>
</table>
 </ItemTemplate>
<HeaderStyle HorizontalAlign="Center" Width="250px" />
<ItemStyle HorizontalAlign="Center" Width="250px" />
 </telerik:GridTemplateColumn>
   </Columns>
<EditFormSettings>
 <EditColumn CancelImageUrl="Cancel.gif" EditImageUrl="Edit.gif" FilterImageUrl="Filter.gif"
  InsertImageUrl="Update.gif" SortAscImageUrl="SortAsc.gif" SortDescImageUrl="SortDesc.gif"
    UpdateImageUrl="Update.gif">
</EditColumn>
  </EditFormSettings>
 <PagerStyle FirstPageImageUrl="PagingFirst.gif" LastPageImageUrl="PagingLast.gif"
 NextPageImageUrl="PagingNext.gif" PrevPageImageUrl="PagingPrev.gif" />
</MasterTableView>
 <HeaderStyle Font-Bold="True" />
</telerik:RadGrid>
Princy
Top achievements
Rank 2
 answered on 19 Mar 2012
5 answers
252 views
Hello Sir,

We are using rad ajax panel with Assembly Version (1.7.2.0) in .net 4.0 framework (Visual Studio 2010) but rad Ajax Panel is not working in my code.

I am using it in asp drop down list with auto postback= true  but When i do selected item from drop down then it is not being PostBack and it is giving javascript error.

Please let me know.How Should I remove this error.

thanks,

Alok
Vasil
Telerik team
 answered on 19 Mar 2012
5 answers
316 views
Hi,

Im creating a popup with the modalPopUpExtender (ajaxcontroltoolkit Version=3.0.30930.28736), for that im using a asp panel and inside them i got two raddatepicker, combobox, enclosing the panel i got a Updatepanel.. something like this:

<updatepanel>
<panel>
   <div>
    <raddatepicker1><raddatepicker2><radcombobox> 
   </div>
   <ajaxToolkit:ModalPopupExtender>
</panel>
<aspbutton> //to open the popup
</updatepanel>

The popup opens fine, but when a control fire an event like combobox selectedindexchaged or i close de popup i got this error:

Server Error in '/' Application.
Invalid JSON primitive: {"minDateStr":"2/28/2012 0:0:0","maxDateStr":"12/31/2099 0:0:0"}.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
 
Exception Details: System.ArgumentException: Invalid JSON primitive: {"minDateStr":"2/28/2012 0:0:0","maxDateStr":"12/31/2099 0:0:0"}.
 
Source Error:
 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
 
Stack Trace:
 
[ArgumentException: Invalid JSON primitive: {"minDateStr":"2/28/2012 0:0:0","maxDateStr":"12/31/2099 0:0:0"}.]
   System.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeserialize(String input, Int32 depthLimit, JavaScriptSerializer serializer) +543674
   System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit) +37
   System.Web.Script.Serialization.JavaScriptSerializer.DeserializeObject(String input) +13
   Telerik.Web.UI.RadWebControl.LoadPostData(String postDataKey, NameValueCollection postCollection) +137
   Telerik.Web.UI.RadDatePicker.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +40
   System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +346
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1743
 
 
Version Information: Microsoft .NET Framework Version:2.0.50727.3625; ASP.NET Version:2.0.50727.3634

I will appreciate your help.
Antonio Stoilkov
Telerik team
 answered on 19 Mar 2012
11 answers
179 views
We have multiple telerik controls on a page and any time you click on the in IE 8 on a win xp machine we get the error attached. Do you know of any solution for this? I should note that the commands (such as a delete command in a gridview, an upload command, etc) actually work, it just pops up with that ajax error every time. Any ideas?
Iana Tsolova
Telerik team
 answered on 19 Mar 2012
1 answer
138 views
I have two Listview's. They are populated the same was. One does not give any evidence of getting any data. HELP!

Here is the definition of the one that has no data:
<telerik:RadListView ID="RadListView2" runat="server" AllowPaging="True" ItemPlaceholderID="ListPlaceHolder"
    Skin="listview_2" EnableEmbeddedSkins="false" DataKeyNames="id,filenameextension,typeAbbr,title"
    OnNeedDataSource="RadListView2_NeedDataSource">
    <LayoutTemplate>
        <table id="products" class="products">
            <thead>
                <tr>
                    <th>
                        Prev
                    </th>
                    <th class="expand">
                    </th>
                    <th>
                        File Name
                    </th>
                    <th>
                        Asset Type
                    </th>
                    <th>
                        Document Type
                    </th>
                    <th>
                        Advertiser Name
                    </th>
                    <th>
                        Advertiser Category
                    </th>
                    <th>
                        Details
                    </th>
                    <th>
                        Market
                    </th>
                    <th>
                        Product Category
                    </th>
                    <th>
                        Keywords
                    </th>
                    <th>
                        Approved
                    </th>
                    <th>
                        Date
                    </th>
                </tr>
            </thead>
            <tbody>
                <tr id="ListPlaceHolder" runat="server">
                </tr>
            </tbody>
        </table>
    </LayoutTemplate>
    <ItemTemplate>
        <tr>
            <td>
                <%# String.Format("javascript:Popup_Window('asset_preview', '{0}');", Eval("id").ToString())%>
            </td>
            <td>
                <asp:CheckBox ID="ChkImage2" runat="server" Style="float: left; padding-top: 5px" />
            </td>
            <td>
                <%# String.Format("javascript:Popup_Window('asset_detail', '{0}');", Eval("id").ToString())%>
            </td>
            <td>
                <%# Eval("typeAbbr")%>
            </td>
            <td>
                <%# Eval("documentTypeText")%>
            </td>
        </tr>
    </ItemTemplate>
    <EmptyDataTemplate>
        No Assets Found 2
    </EmptyDataTemplate>
</telerik:RadListView>
Andrey
Telerik team
 answered on 19 Mar 2012
1 answer
226 views
Hi,

                                 I have put two tabs in my tabstrip and added a multipageview.Every time when i opens the tabstrip i want my first tab to be opened even i have opened the second one before last close.I have set the selectedindex to '0',but it doesn't work for me.
Kate
Telerik team
 answered on 19 Mar 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?