Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
88 views

I am using programmatic sorting on my radgrid that has both master and detail data. My sorting works fine for the master table and I am getting my child data via this event:

Private Sub RadGrid1_DetailTableDataBind(ByVal source As Object, ByVal e As GridDetailTableDataBindEventArgs) Handles RadGrid1.DetailTableDataBind
    Dim dataItem As GridDataItem = CType(e.DetailTableView.ParentItem, GridDataItem)
    Select Case e.DetailTableView.Name
        Case "Orders"
            Dim CustomerID As String = dataItem.GetDataKeyValue("CustomerID").ToString()
            e.DetailTableView.DataSource = GetDataTable("SELECT * FROM Orders WHERE CustomerID = '" & CustomerID & "'")
        Case "OrderDetails"
            Dim OrderID As String = dataItem.GetDataKeyValue("OrderID").ToString()
            e.DetailTableView.DataSource = GetDataTable("SELECT * FROM [Order Details] WHERE OrderID = " & OrderID)
    End Select
End Sub


What I can not figure out is how to sort my detail table.  In the 
 

 

 

Protected Sub RadGrid1_SortCommand1(sender As Object, e As Telerik.Web.UI.GridSortCommandEventArgs) Handles  RadGrid1.SortCommand

 

 

event I use    e.Item.OwnerTableView.DataSource = m_dtSort and e.Item.OwnerTableView.Rebind() to rebind my MasterTable.  How do I sort my detail data and rebind?

Thanks

John

Princy
Top achievements
Rank 2
 answered on 30 Apr 2011
0 answers
266 views
Hi,
 i am D. Srinivas Rao.
in my aspx page i have a JavaScript function for calling a server side event when click on the Check box. The following is the code for Java Script Function.

<telerik:RadCodeBlock runat="server">

        <script language="javascript" type="text/javascript">

            function GetMessage(sender, args) {

                PageMethods.CompletedCheck();
alert("Hii");

               }

           </script>

         <telerik:RadScriptManager id="RadScriptManager" runat="server"

    EnablePageMethods="True">

</telerik:RadScriptManager>

        </telerik:RadCodeBlock>

and this function called in CheckBox checked event.. the Following is the Code for CheckBox Control

<telerik:GridTemplateColumn UniqueName="Complete" HeaderText="Completed" AllowFiltering="false">

                        <ItemTemplate>

                            <asp:Panel ID="Panel1" runat="server" Width="2px">

                             <asp:CheckBox ID="chkComplete" runat="server" AutoPostBack="true" onclick="GetMessage()" />

                            </asp:Panel>

                        </ItemTemplate>

</telerik:GridTemplateColumn>

and my Code Behind is

<System.Web.Services.WebMethod()> _

    Public Shared Sub CompletedCheck(ByVal sender As Object, ByVal e As System.EventArgs)

       //code here

         End Sub

in the above grid template check-box control will fire the JavaScript  function GetMessage() Well, but it doesn't execute the Code Behind Event.

Please Help me how to execute the Code Behind Method  using JavaScript Function..

Thank You
D.Srinivasa Rao


D.SRINIVASA
Top achievements
Rank 2
 asked on 30 Apr 2011
1 answer
151 views
Is there a way for me to set DefaultInsertValue of a column either with server-side or javascript?  I want to put a variable into this property.

Princy
Top achievements
Rank 2
 answered on 30 Apr 2011
0 answers
69 views
Data will be saved only if there is which radtab is changed that controls should be saved .
it's possible in radTabStrip

Problem resolved

Thanks,
Mohamed.
mohamed
Top achievements
Rank 1
 asked on 30 Apr 2011
3 answers
303 views

 

 


I am trying to set conditional RadComboBoxItem visibility using javascript: RadComboBoxItem.hide().  It will work fine without Filter="Contains" enabled on the ComboBox, but when this is turned on, the ComboBox shows the hidden items the second time it is opened.  Is there any way around this.

Thanks,
Thomas

aspx:

 

<telerik:RadComboBox runat="server" ID="rcbTest" Filter="Contains" > 
    <Items> 
        <telerik:RadComboBoxItem Text="Test1" /> 
        <telerik:RadComboBoxItem Text="Test2" /> 
        <telerik:RadComboBoxItem Text="Test3" /> 
        <telerik:RadComboBoxItem Text="Test4" /> 
    </Items> 
</telerik:RadComboBox> 
<asp:CheckBox ID="cbxTest" runat="server" onclick="Test(this);" /> 

javascript:

 
    function Test(cbx) {  
        var rcb = $find('<%=rcbTest.ClientID %>');  
        var items = rcb.get_items();  
        for (var i = 0; i < items.get_count(); i++) {  
            if (i != 2) {  
                if(cbx.checked)  
                    items.getItem(i).hide();  
                else  
                    items.getItem(i).show();  
            }  
                  
        }  
    } 

 

Jesus
Top achievements
Rank 1
 answered on 29 Apr 2011
2 answers
169 views
I have a radgrid where each row is basically a set of drop down boxes and text boxes that the user can edit...they can "Add" new rows of the same control and it should just add a defaulted row of that those controls in edit mode to the bottom of the grid...

When I first bind the Datasource it works fine...binds the one row that exists in the table to the grid..when I add a new row my routine that constructs a new datatable based on the existing rows in the grid and adding a new default row to the bottom works fine...however when it gets rebound to the grid the new row is not in edit mode and the original row is now doubled... (please see attached document for image samples...)



<Telerik:RadGrid ID="rgRuleCompares" runat="server" 
            onitemdatabound="rgRuleCompares_ItemDataBound" 
            EnableLinqExpressions="False" Width="100%" AllowPaging="True" 
            PageSize="10" DataMember="reg_rule_compares" GridLines="None" 
                                    onprerender="rgRuleCompares_PreRender1" 
                                    onitemcommand="rgRuleCompares_ItemCommand" 
                                    onneeddatasource="rgRuleCompares_NeedDataSource1" EnableViewState="true" >
        <MasterTableView DataKeyNames="column_name,comparison_type,comparison_value,start_and_or" CommandItemDisplay="Top" AutoGenerateColumns="False" HeaderStyle-Height="10px" EditMode="InPlace" DataMember="reg_rule_compares" HeaderStyle-CssClass="gridHeader" AllowAutomaticDeletes="False" AllowAutomaticInserts="False" AllowAutomaticUpdates="False" >
            <Columns>
                <Telerik:GridDropDownColumn UniqueName="start_and_or" DataField="start_and_or" HeaderText="Comparison Item" ListDataMember="start_and_or" ListTextField="start_and_or" ListValueField="start_and_or"/>
                <Telerik:GridDropDownColumn UniqueName="column_name" DataField="column_name" HeaderText="Register Column"  ListDataMember="column_names" ListTextField="column_name" ListValueField="column_name"/>
                <Telerik:GridDropDownColumn UniqueName="comparison_type" DataField="comparison_type" HeaderText="Comparison Type"  ListDataMember="comparison_type" ListTextField="comparison_type" ListValueField="comparison_type"/>
                <Telerik:GridBoundColumn UniqueName="comparison_value" DataField="comparison_value" DataType="System.String" HeaderText="Comparison Value"  />
            </Columns>
        </MasterTableView>
        <ClientSettings>
            <Selecting AllowRowSelect="True" />
        </ClientSettings>
    </Telerik:RadGrid>



 protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {             
                DataTable dt = GetEmptyCompareTable();
                dt = AddFirstCompareRow(dt);
                GetCompareData(dt);

                rgRuleCompares.DataBind();
            
            }
        }

protected void rgRuleCompares_ItemCommand(object sender, GridCommandEventArgs e)
        {
            DataTable dt = BuildCompareTableFromGrid();
            dt = AddNewCompareRow(dt);
            GetCompareData(dt);

        }

        private DataTable BuildCompareTableFromGrid()
        {
            int cnt = rgRuleCompares.Items.Count;
            DataTable dt = GetEmptyCompareTable();


            for (int i = 0; i < cnt; i++)
            {
                GridEditableItem editedItem = (GridEditableItem)rgRuleCompares.EditItems[0];
                string val1 = editedItem.OwnerTableView.DataKeyValues[i]["start_and_or"].ToString();
                string val2 = editedItem.OwnerTableView.DataKeyValues[i]["comparison_type"].ToString();
                string val3 = editedItem.OwnerTableView.DataKeyValues[i]["comparison_value"].ToString();
                string val4 = editedItem.OwnerTableView.DataKeyValues[i]["column_name"].ToString();


                DataRow row;
                row = dt.NewRow();
                row["start_and_or"] = val1;
                row["column_name"] = val4;
                row["comparison_type"] = val2;
                row["comparison_value"] = val3;
                dt.Rows.Add(row);


            }
            return dt;
        }

 private DataTable GetEmptyCompareTable()
        {
            DataTable dt = new DataTable();
            DataColumn col;
            //This adds a column to the table
            col = new DataColumn();
            col.DataType = System.Type.GetType("System.String");
            col.ColumnName = "start_and_or";
            dt.Columns.Add(col);
            //This adds a column to the table
            col = new DataColumn();
            col.DataType = System.Type.GetType("System.String");
            col.ColumnName = "column_name";
            dt.Columns.Add(col);
            //This adds a column to the table
            col = new DataColumn();
            col.DataType = System.Type.GetType("System.String");
            col.ColumnName = "comparison_type";
            dt.Columns.Add(col);
            //This adds a column to the table
            col = new DataColumn();
            col.DataType = System.Type.GetType("System.String");
            col.ColumnName = "comparison_value";
            dt.Columns.Add(col);


            dt.TableName = "reg_rule_compares";


            return dt;
        }

 private void GetCompareData(DataTable dt)
        {
            DataSet ds = new DataSet();
            dt.TableName = "reg_rule_compares";
            ds.Tables.Add(dt);
            ds = BuildCompareDropDownTables(ds);
            
            rgRuleCompares.DataSource = ds;
        }

 private DataSet BuildCompareDropDownTables(DataSet ds)
        {
            DataTable dt = new DataTable();
            DataColumn col;
            //This adds a column to the table
            col = new DataColumn();
            col.DataType = System.Type.GetType("System.String");
            col.ColumnName = "comparison_type";
            dt.Columns.Add(col);


            string[] s = { "Contains", "StartsWith", "EndsWith", "=" };


            foreach (string str in s)
            {
                string field = str.ToString();


                DataRow row;
                row = dt.NewRow();
                row["comparison_type"] = field;
                dt.Rows.Add(row);


            }
            dt.TableName = "comparison_type";
            ds.Tables.Add(dt);


            dt = new DataTable();
            
            //This adds a column to the table
            col = new DataColumn();
            col.DataType = System.Type.GetType("System.String");
            col.ColumnName = "column_name";
            dt.Columns.Add(col);


            string[] s1 = { "Memo", "Payee" };


            foreach (string str in s1)
            {
                string field = str.ToString();


                DataRow row;
                row = dt.NewRow();
                row["column_name"] = field;
                dt.Rows.Add(row);


            }
            dt.TableName = "column_names";
            ds.Tables.Add(dt);


            dt = new DataTable();


            //This adds a column to the table
            col = new DataColumn();
            col.DataType = System.Type.GetType("System.String");
            col.ColumnName = "start_and_or";
            dt.Columns.Add(col);


            string[] s2 = { "START", "AND", "OR" };


            foreach (string str in s2)
            {
                string field = str.ToString();


                DataRow row;
                row = dt.NewRow();
                row["start_and_or"] = field;
                dt.Rows.Add(row);


            }
            dt.TableName = "start_and_or";
            ds.Tables.Add(dt);                     


            return ds;
        }

  private DataTable AddFirstCompareRow(DataTable dt)
        {
            DataRow row;
            row = dt.NewRow();
            row["start_and_or"] = "START";
            row["column_name"] = "Memo";
            row["comparison_type"] = "Contains";
            row["comparison_value"] = "";
            dt.Rows.Add(row);


            return dt;
        }


        private DataTable AddNewCompareRow(DataTable dt)
        {
            DataRow row;
            row = dt.NewRow();
            row["start_and_or"] = "AND";
            row["column_name"] = "Memo";
            row["comparison_type"] = "Contains";
            row["comparison_value"] = "";
            dt.Rows.Add(row);

            return dt;
        }


 private void rgRuleCompares_PreRender(object sender, System.EventArgs e)
        {
            
                foreach (GridItem item in rgRuleCompares.MasterTableView.Items)
                {
                    if (item is GridEditableItem)
                    {
                        GridEditableItem editableItem = item as GridDataItem;
                        editableItem.Edit = true;
                    }
                }
                rgRuleCompares.Rebind();
            
        }

 protected void rgRuleCompares_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
           
        }
Matthew
Top achievements
Rank 1
 answered on 29 Apr 2011
1 answer
31 views
I want to use teh "AddNewRecordButton"  because I want to fire off the ItemCommand eventHandler. However, I dont want to have a new row inserted into the grid...I want to run my own function instead...is there a way to do this?


Thanks
Matthew
Top achievements
Rank 1
 answered on 29 Apr 2011
2 answers
136 views
Hello. I'm using the RadEditor control without the toolbars as recommended here:
http://www.telerik.com/community/forums/aspnet-ajax/editor/remove-toolbar.aspx
This works fine, but I'm also trying to show a RadWindow. The style for hiding the
toolbar is causing the RadWindow to not show. I believe the offending style is this.
.RadWindow.RadWindow_Default.rwNormalWindow.rwTransparentWindow 
    { 
        display: none !important; 
    } 

Is it possible to use the RadEditor without a toolbar and show a RadWindow?

Thanks
Scott

Scott Michetti
Top achievements
Rank 1
Iron
 answered on 29 Apr 2011
2 answers
88 views
I need to put a small label between the gridview and the paging buttons of the gridview. I need to display a value in that label that is completely unrealted with the gridview stored proc.This value is coming from a different stored proc. user want to see the value between the gridview and paging buttons, the next and prev buttons. Is it possible to do that.

Any help will be higly apprceciated
Anjali
Top achievements
Rank 1
 answered on 29 Apr 2011
3 answers
208 views

We are using the ListBox control on a common page in our application.  We are using the Move Up, Move Down and Delete features.  This control is used in 508 and non-508 mode.  We are unable to tab into the ListBox no matter what mode we are in.  Is tabbing into this control supported?  Is there a different way to get to the rows of the box without using the mouse?

<telerik:RadListBox ID="rlbFilters" runat="server" AllowDelete="True" 
    AllowReorder="True" Height="100px" Width="450px" OnDeleted="OnCriteriaRemoval" 
    OnReordered="OnCriteriaReorderd" OnClientSelectedIndexChanged="rlbFilters_SelectedIndexChanged"
    AutoPostBackOnReorder="true" AutoPostBackOnDelete="true" Visible="false" >
    <ButtonSettings />
</telerik:RadListBox>


Thank you,
Lindsay

Mike
Top achievements
Rank 1
 answered on 29 Apr 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?