Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
244 views

Trying to use a RadSearchBox in a FilterTemplate while using OpenAccess (I believe using simple binding?)  -  not sure how to get the filtering to work/in code behind - looked at several samples/demos - but none seem to show how or if it will work when using OpenAccess (trying to stick with simple binding if possible)

Test code below

 

 

<telerik:RadGrid ID="RadGridResults" runat="server" AutoGenerateColumns="False"
 
 CellSpacing="0" DataSourceID="OpenAccessLinqDataSource"
 
 GridLines="None" AllowPaging="True"
 
 AllowSorting="True" EnableLinqExpressions="False"
 
 AllowFilteringByColumn="True">
 
 <ClientSettings>
 
 <Scrolling AllowScroll="True" UseStaticHeaders="True" />
 
 </ClientSettings>
 
 <MasterTableView DataKeyNames="ProductID"
 
 DataSourceID="OpenAccessLinqDataSource1">
 
 <Columns>
 
 <telerik:GridBoundColumn DataField="ProductRef" FilterControlAltText="Filter Product Ref column"
 
 HeaderText="ProductRef" SortExpression="ProductRef" UniqueName="ProductRef">
 
 </telerik:GridBoundColumn>
 
 <telerik:GridDropDownColumn FilterControlAltText="Filter Brand Name column" UniqueName="ProductBrandName"
 
 DataSourceID="OpenAccessLinqDataSourceBrandName" DataField="ProductBrandNameID"
 
 HeaderText="Brand Name" SortExpression="CompanyName" ListValueField="CompanyID"
 
 AllowSorting="true" ListTextField="CompanyName" DropDownControlType="DropDownList">
 
 <FilterTemplate>
 
 <telerik:RadSearchBox ID="RadSearchBox1" runat="server" DataSourceID="OpenAccessLinqDataSourceBrandName"
 
 DataTextField="CompanyName" DataValueField="CompanyID" ShowSearchButton="False" OnSearch="RadSearchBox1_Search">
 
 </telerik:RadSearchBox>
 
 </FilterTemplate>
 
 </telerik:GridDropDownColumn>

Tried using code below but DataBind() causes error 'Expression Expected' - have set 'EnableLinqExpressions=False' - as per other threads/samples

 

 

 

Protected Sub RadSearchBox1_Search(sender As Object, e As SearchBoxEventArgs)
 
 RadGridResults.MasterTableView.FilterExpression = "([ProductBrandName] = " + e.Text + ")"
 
 Dim column As GridColumn = RadGridResults.MasterTableView.GetColumnSafe("ProductBrandName")
 
 column.CurrentFilterFunction = GridKnownFunction.EqualTo
 
 column.CurrentFilterValue = e.Text
  
 RadGridResults.DataBind()
  
 End Sub

 

 

 

 


Calsh
Top achievements
Rank 1
 answered on 15 Oct 2013
2 answers
409 views
hi,

I am using telerik radgrid in my application  hierarchical model. in detailtables i have one  GridTableView. in the GridTableView i have a GridTemplateColumn in which i have two radio buttons and one textbox. when user enters a value in the textbox and click radio button it should fill all the other textboxes  of the row edited or inserted based on some calculation.

The design as follows.
Please advice me how to work ?
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" Skin="Black" OnItemDataBound="RadGrid1_ItemDataBound" OnItemCreated="RadGrid1_ItemCreated"
    AllowSorting="True" AllowMultiRowSelection="False" OnItemCommand="RadGrid1_ItemCommand" AutoGenerateEditColumn="false"
    OnDetailTableDataBind="RadGrid1_DetailTableDataBind" OnNeedDataSource="RadGrid1_NeedDataSource" OnInsertCommand="RadGrid1_InsertCommand"
    OnPreRender="RadGrid1_PreRender" >
 
    <MasterTableView DataKeyNames="TempAccountsId" ShowFooter="true" TableLayout="Fixed" AllowMultiColumnSorting="True"  EditMode="InPlace" >
        <DetailTables>
            <telerik:GridTableView DataKeyNames="CleaningId" CommandItemDisplay="Top"  TableLayout="Fixed" Name="Cleaning" ShowFooter="true" EditMode="InPlace" AllowAutomaticUpdates="false">
                <Columns>
                    <telerik:GridTemplateColumn Visible="false">
                        <ItemTemplate>
                            <asp:Label ID="lblCleaningId" runat="server" Text='<%#Eval("CleaningId") %>'></asp:Label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridEditCommandColumn ButtonType="ImageButton" HeaderText="Edit" UniqueName="Edit" ItemStyle-Width="25px" HeaderStyle-HorizontalAlign="Center"
                        EditImageUrl="../Images/edit.gif" ItemStyle-HorizontalAlign="Center">
                    </telerik:GridEditCommandColumn>
                    <telerik:GridTemplateColumn HeaderText="Delete" UniqueName="Delete" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="40px" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:ImageButton runat="server" ID="imgdelete" OnClientClick="return confirm('Are you sure that you want to Delete?');"
                                ImageUrl="../Images/delete.gif" CommandName="Delete" CommandArgument="" />
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                 
                     
 
                    <telerik:GridTemplateColumn HeaderStyle-Width="180" UniqueName="Rate" HeaderText="Rate" ItemStyle-HorizontalAlign="Left"
                            HeaderStyle-HorizontalAlign="Center" FooterStyle-HorizontalAlign="Right">
                            <ItemTemplate>
                                <asp:RadioButton ID="rdbtnPerSqft" runat="server" Text="PerSqft" GroupName="Rate" Enabled="false" Checked='<%# bool.Parse(Eval("IsPerSqftRate").ToString()) %>' />
                                <asp:RadioButton ID="rdbtnFlat" runat="server" Text="Flat" GroupName="Rate" Enabled="false" Checked='<%# bool.Parse(Eval("IsFlatRate").ToString()) %>' />
                            </ItemTemplate>
                        <EditItemTemplate>
                             <asp:RadioButton ID="rdbtnPerSqftEdit" runat="server" Text="PerSqft" GroupName="Rate" Checked='<%# bool.Parse(Eval("IsPerSqftRate").ToString()) %>'   />
                                <asp:RadioButton ID="rdbtnFlatEdit" runat="server"  CommandName="Flatrate" Text="Flat" GroupName="Rate" Checked='<%# bool.Parse(Eval("IsFlatRate").ToString()) %>' />
                                <asp:TextBox ID="txtRateEdit" runat="server"  Width="55" CssClass="AlgRgh" Visible="true"  Text='<%# string.Format("{0:n}", Convert.ToDecimal(Eval("PerSqFtRate"))) %>'
                                    onkeypress="javascript:return Allownumbersonly(event);" BorderWidth="1px" ></asp:TextBox>
                        </EditItemTemplate>
                        <InsertItemTemplate>
                            <asp:RadioButton ID="rdbtnPerSqftinsert"  runat="server" Text="PerSqft" GroupName="Rate"    />
                                <asp:RadioButton ID="rdbtnFlatinsert" runat="server" Text="Flat" GroupName="Rate"   />
                                <asp:TextBox ID="txtRateinsert" runat="server"  Width="55"  CssClass="AlgRgh"
                                    onkeypress="javascript:return Allownumbersonly(event);" BorderWidth="1px" ></asp:TextBox>
                        </InsertItemTemplate>
                        </telerik:GridTemplateColumn>
 
                </Columns>
            </telerik:GridTableView>
        </DetailTables>
        <Columns>
            <telerik:GridTemplateColumn HeaderText="AccountId" UniqueName="TempAccountsId" Visible="false">
                <ItemTemplate>
                    <asp:Label ID="lblTempAccountsId" runat="server" Text='<%#Eval("TempAccountsId") %>'></asp:Label>
                </ItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn HeaderText="Account Number" UniqueName="AccountNumber" ItemStyle-Width="120px" HeaderStyle-Width="120px" HeaderStyle-HorizontalAlign="left" ItemStyle-HorizontalAlign="left">
                <ItemTemplate>
                    <asp:Label ID="lblAccountNumber" runat="server" Text='<%#Eval("AccountNumber") %>'></asp:Label>
                </ItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn HeaderText="Account Name" UniqueName="AccountName" ItemStyle-Width="140px" HeaderStyle-Width="140px" HeaderStyle-HorizontalAlign="left" ItemStyle-HorizontalAlign="left">
                <ItemTemplate>
                    <asp:Label ID="lblAccountName" runat="server" Text='<%#Eval("AccountName") %>'></asp:Label>
                </ItemTemplate>
                <FooterTemplate>
                    <asp:Label ID="lbltotalFooter" runat="server" Text="Total:"></asp:Label>
                </FooterTemplate>
            </telerik:GridTemplateColumn>
             
        </Columns>
    </MasterTableView>
    <ClientSettings AllowKeyboardNavigation="true" EnableRowHoverStyle="true">
        
    </ClientSettings>
</telerik:RadGrid>
courtney shoell
Top achievements
Rank 1
 answered on 15 Oct 2013
2 answers
530 views

Hi,

I have a checkbox set up as such:

<

 

 

telerik:GridCheckBoxColumn DataField="HaulSampledTrueFalse" HeaderText="Haul Sampled?" Visible="false" UniqueName="HaulSampledTrueFalse" EditFormColumnIndex="1"></telerik:GridCheckBoxColumn>

Could someone please advise how to set the state of the checkbox to "ticked" if the data field that the checkbox is bound to, is True.

Thanks, Ida

 

Ida
Top achievements
Rank 1
 answered on 15 Oct 2013
2 answers
130 views
Hi , 
Im using Telerik 2011 Q3 . How can i setting title text format ( color , police ... )  in a radImageTile ? i don't find property ...

Thank's .  
SOFIENE
Top achievements
Rank 1
 answered on 15 Oct 2013
1 answer
92 views
Hi,
I have an unusual question regarding listview. I have used many controls like drop down , gridview etc but didn't find anything like to rebind the control whenever its selectedindexchanged event is fired?

But today when i was working with the Listview of which i was firing its SelectedIndexChanged event on item selection, what i noticed that the event runs successfully for the first time and details of the item selected is shown but as soon as some other item is selected, the event throws an error on the code where it accepts the item value - as shown below

ArgumentOutOfRangeException :
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Exception is thrown when : 

ItemID = ItemListView.SelectedValue.ToString();


 I Though of rebinding it in the event itself and the problem went away.
I am still confused that why i should rebind listview in the SelectedIndexChanged event.

Thanks for reading and any usefull info will be appreciated ..!!
Kostadin
Telerik team
 answered on 15 Oct 2013
1 answer
114 views
Hi,
Iam using Radgrid for ASP.NET project.
In my grid i have 3 textbox column
for Qty,Price and Total Amont as textbox.
Using clientscript i do calculate on Qty*Price textbox value and update the result in Total Amount text box.

upto this its works fine.
but when i click some button ,using Pagin or during postback the new changed value is not displaying.

My code:
in Item data Bound:
 txtQty.Attributes.Add("onFocusout", "return calculate('" + txtQty.ClientID + "','" + txtamnt.ClientID + "','" + txttotamnt.ClientID + "'," + index + ")");
            txtamnt.Attributes.Add("onFocusout", "return calculate('" + txtQty.ClientID + "','" + txtamnt.ClientID + "','" + txttotamnt.ClientID + "'," + index + ")");
            txttotamnt.Attributes.Add("onfocus", "return calculate('" + txtQty.ClientID + "','" + txtamnt.ClientID + "','" + txttotamnt.ClientID + "'," + index + ")");


and my javascript.
 function calculate(cntl1, cntl2, cntl3,rowindex)
           {
                var text1 =$find(cntl1);
                var text2 =$find(cntl2);
                var text3 = $find(cntl3);
               // alert(rowindex);
                var total = text1.get_value() * text2.get_value();
                text3.set_value(total);
                radGrid.MasterTableView.get_dataItems()[rowindex].get_cell("displayAmnt").innerHTML = total;
            }

how to achive textbox Value change value using client side and presist the value.
Angel Petrov
Telerik team
 answered on 15 Oct 2013
3 answers
543 views
Hi,
I'm trying to set ColumnEditorID to GridNumericColumnEditor in radgrid (pop up edit mode).
So:
 <telerik:GridBoundColumn DataField="TRNO_ID" DataType="System.Decimal" HeaderText="ID"
 ColumnEditorID="TRNO_ID_CE">   
</telerik:GridBoundColumn>  


 <telerik:GridNumericColumnEditor ID="TRNO_ID_CE" NumericTextBox-EnabledStyle-HorizontalAlign="Right" 
                                    runat="server" NumericTextBox-Width="75px"
                                    <NumericTextBox ID="NumericTextBox1" runat="server"
                                        <NumberFormat DecimalDigits="2" /> 
                                    </NumericTextBox> 
</telerik:GridNumericColumnEditor> 
But in edit mode this field is displaying like normal textbox.
But when I set:
<telerik:GridTextBoxColumnEditor ID="TRNO_ID_CE" runat="server"
                                    <TextBoxStyle BackColor="#edffc3" BorderColor="#ecbb0d" BorderStyle="Solid" ForeColor="#7fa822" /> 
</telerik:GridTextBoxColumnEditor> 
in edit mode this field has changed background (it's work).
Where is a problem?
Radoslav
Telerik team
 answered on 15 Oct 2013
1 answer
139 views
I have taken many radComboBoxes with treeViews inside of them and converted them to the RadDropDownTree.  On all the previous ones the onEntryAdded has triggered but on only one of them it is not why could this be?  Here is the one that is broken.

<telerik:RadDropDownTree
    ID="personalCriteriaDropDownTree"
    runat="server"
    AutoPostBack="True"
    DefaultMessage="Enterprise"
    DataFieldID="ID"
    DataFieldParentID="ParentID"
    DataTextField="Name"
    DataValueField="TYPE"
    DropDownSettings-AutoWidth="Disabled"
    DropDownSettings-Height="400px"
    ExpandNodeOnSingleClick="True"
    FullPathDelimiter=" > "
    OnClientEntryAdding="onProgramDropDownClientEntryAdding"
    OnClientEntryAdded="persNodeClicking"
    OnClientEntryRemoved="onProgramDropDownClientEntryRemoved"
    OnClientDropDownClosed="persNodeClosing"
    OnEntryAdded ="ProgramDropDownTree_EntryAdded"
    OnNodeDataBound="PersonalCriteriaDownTree_NodeDataBound"
    TextMode="FullPath"
    Width="300px">
    <HeaderTemplate>
        <div class="header">
            <span style="color: red">* Words in Bold are selectable                                       
            </span>
        </div>
    </HeaderTemplate>
    <FooterTemplate>
        <div class="footer">
            <span style="color: red">* Words in Bold are selectable
 
            </span>
        </div>
    </FooterTemplate>
</telerik:RadDropDownTree>
Shinu
Top achievements
Rank 2
 answered on 15 Oct 2013
6 answers
135 views
i have 2 listbox with the transfer option and i'm showing they're results on a radgrid selectedindex changed but this items of listbox are loaded in code behind but because of the listbox's are inside a radajaxpanel it dont show any data in the radlistbox i take out the radupdatepanel and items are showed, so why with that they are not showing ... since the are loaded from the datatable i checked before with breakpoint 
Bozhidar
Telerik team
 answered on 15 Oct 2013
2 answers
149 views
Hi

I have RadGrid with DetailTables. I am exporting records in Excel.

I have used ExcelML format. It's working fine but I want the DetailTable with different background color. I also want to apply Header color to MasterTableView. But It's not working as I have used ExcelML format.

Is there any solution.?

Thanks
Kamini
Kostadin
Telerik team
 answered on 15 Oct 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?