Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
296 views
I have a screen that contains a Radgrid.  In this radgrid I have three filterTemplates that use a Radcombobox, and a GridNumericColumn for filtering.

It works fine when I filter on only one column but when I try want to filter by more than one it only filters on the current column.  I have changed the code behind to save the current filter and add the changes to it, the problem is I need to remove the existing filter and rebuild it based on the values from the selected filters.

<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" EnableLinqExpressions="false"
                    PageSize="25" AutoGenerateColumns="False" GridLines="None" AllowSorting="True"
                    AllowFilteringByColumn="true" AlternatingItemStyle-BackColor="#eeeeee" ShowStatusBar="True"
                    OnItemCreated="RadGrid1_ItemCreated" OnPreRender="RadGrid1_PreRender" OnNeedDataSource="RadGrid1_NeedDataSource"
                    OnItemDataBound="RadGrid1_ItemDataBound" OnInsertCommand="RadGrid1_InsertCommand"
                    OnUpdateCommand="RadGrid1_UpdateCommand" Width="100%">
                    <PagerStyle AlwaysVisible="true" Mode="NextPrevAndNumeric" />
                    <MasterTableView CommandItemDisplay="Top" DataKeyNames="AuditID" EditMode="InPlace">
                        <AlternatingItemStyle BackColor="#EEEEEE"></AlternatingItemStyle>
                        <Columns>
                            <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" HeaderStyle-Width="50px" />
                            <telerik:GridTemplateColumn HeaderText="Branch" DataField="CRDBranchNumber" SortExpression=""
                                UniqueName="CRDBranchNumber" HeaderStyle-Width="160px">
                                <FilterTemplate>
                                    <telerik:RadComboBox ID="rcbBranch" DataTextField="CRDBranchNumber" DataValueField="CRDBranchNumber"
                                        AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("CRDBranchNumber").CurrentFilterValue %>'
                                        runat="server" AutoPostBack="true" OnSelectedIndexChanged="BranchCombo_SelectedIndexChanged" />
                                </FilterTemplate>
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lbCRDBranchNumber" Text='<%# Eval("CRDBranchNumber") %>' />
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <telerik:RadComboBox ID="rcbCRDBranchNumber" DataTextField="CRDBranchNumber" DataValueField="CRDBranchNumber"
                                        runat="server" Width="115px" />
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="rcbCRDBranchNumber"
                                        ErrorMessage="*" runat="server" ToolTip="Branch is Required" InitialValue="Select Branch"
                                        ForeColor="Red" />
                                    <asp:Label runat="server" ID="ldID" Visible="false" Text='<%# Eval("CRDBranchNumber") %>' />
                                </EditItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn HeaderText="Auditor" DataField="AuditorName" SortExpression=""
                                UniqueName="AuditorName" HeaderStyle-Width="225px">
                                <FilterTemplate>
                                    <telerik:RadComboBox ID="rcbAuditor" DataTextField="AuditorName" DataValueField="AuditorName"
                                        AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("AuditorName").CurrentFilterValue %>'
                                        runat="server" AutoPostBack="true" OnSelectedIndexChanged="AuditorCombo_SelectedIndexChanged" />
                                </FilterTemplate>
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lbAuditor" Text='<%# Eval("AuditorName") %>' />
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <telerik:RadComboBox ID="rcbAuditor" DataTextField="AuditorName" DataValueField="AuditorID"
                                        runat="server" Width="175px" />
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="rcbAuditor"
                                        ErrorMessage="*" runat="server" ToolTip="Auditor is Required" InitialValue="Select Auditor"
                                        ForeColor="Red" />
                                    <asp:Label runat="server" ID="ldAuditorID" Visible="false" Text='<%# Eval("AuditorID") %>' />
                                </EditItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridNumericColumn DataField="AuditYear" HeaderText="Audit Year" SortExpression="AuditYear"
                                UniqueName="AuditYear" DataType="System.Decimal" DataFormatString="{0:F0}" />
                            <telerik:GridDateTimeColumn SortExpression="ScheduledDate" DataField="ScheduledDate"
                                HeaderText="Scheduled" DataType="System.DateTime" DataFormatString="{0:MM/dd/yyyy}"
                                AllowFiltering="false" HeaderStyle-Width="100px" UniqueName="ScheduledDate" />
                            <telerik:GridDateTimeColumn SortExpression="CompletedDate" DataField="CompletedDate"
                                HeaderText="Completed" DataType="System.DateTime" DataFormatString="{0:MM/dd/yyyy}"
                                AllowFiltering="false" HeaderStyle-Width="100px" UniqueName="CompletedDate" />
                            <telerik:GridTemplateColumn HeaderText="Status" DataField="Status" SortExpression=""
                                UniqueName="Status" HeaderStyle-Width="195px">
                                <FilterTemplate>
                                    <telerik:RadComboBox ID="rcbStatus" DataTextField="Status" DataValueField="Status"
                                        AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("Status").CurrentFilterValue %>'
                                        runat="server" AutoPostBack="true" OnSelectedIndexChanged="StatusCombo_SelectedIndexChanged" />
                                </FilterTemplate>
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lblStatus" Text='<%# Eval("Status") %>' />
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <telerik:RadComboBox ID="rcbStatus" DataTextField="Status" DataValueField="AuditStatusID"
                                        runat="server" Width="150px" />
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" ControlToValidate="rcbStatus"
                                        ErrorMessage="*" runat="server" ToolTip="Status is Required" InitialValue="Select Status"
                                        ForeColor="Red" />
                                    <asp:Label runat="server" ID="lbAuditStatusID" Visible="false" Text='<%# Eval("AuditStatusID") %>' />
                                </EditItemTemplate>
                            </telerik:GridTemplateColumn>
                        </Columns>
                        <EditFormSettings>
                            <EditColumn InsertText="Insert Audit" UpdateText="Update Audit" UniqueName="EditCommandColumn1"
                                CancelText="Cancel edit">
                            </EditColumn>
                        </EditFormSettings>
                    </MasterTableView>
                </telerik:RadGrid>

Is there a way I can iterate through the columns, get the values of the selected filter and build a filter string.
Genti
Telerik team
 answered on 14 Jul 2011
2 answers
81 views
Hi All,

I have a Telerik grid placed in a usercontrol page.

In Internet Explorer everything is working fine,But in Firefox the columns are getting collapsed .
One column is coming above the other

Please help me its very urgent.
Radoslav
Telerik team
 answered on 14 Jul 2011
7 answers
81 views
hi, the problem im experiencing is regarding a checkbox enabled radtreeview with options
TriStateCheckBoxes="true"
CheckChildNodes="false"

The  rootnode (if no child nodes are selected) does successfully identify (and save) the checkstatus to the database by using:
the RadTreeView1.CheckedNodes method
and when I load the tree, I do in fact load the parent node that is checked, with the checked status

the problem is that when the tree is reloaded ,whilst it does identify that the parent node has a checked status, it does not physically put a check mark next to it on the client side ,although the node.checked  instruction definitely gets executed for the specific rootnode

e.g. of problem
Fruit
   - Strawberrys
   - Apples
Vegetables
  - Cauliflower
  - Pumpkin
Other

If i only select fruit, and not strawberries or apples, (thus only selecting the Fruit checkbox), then when the tree gets saved, and reloaded, the Fruit checkbox is not ticked, even though if you loop through the RadTreeView.CheckedNodes, the Fruit node actually says it does have the checked status, even though the Fruit node does not show the checked status on the front end

the outcome of the problem is thus that the user checks a rootnode, the tree gets reloaded in the backend, and then even though the tree knows (and the properties say) that the rootnode is checked, it does not show the user that the rootnode is checked

also in the ReloadTree event i created (listed below), even if i just instruct the (root)node to be checked, in the very next line the checkstate of the node is unchecked.

Also interesting, if i check a Rootnode which does not have childnodes ("Other" in the example), there is no problem, it saves and when the tree is populated, it loads the checkbox again, so this only happens if there are child nodes


any help? I have to redo a whole system if i cant get this to work
was this perhaps fixed in newer versions of radtreeview?

 

Protected Sub ReloadCreatedRADTree(ByVal tv As RadTreeView, ByVal dt As DataTable)
           
        Dim message As String = ""
        Dim nodeColletion As IList = tv.GetAllNodes
  
        For Each node As RadTreeNode In nodeColletion
                Dim iLoopDT As Integer
  
            For iLoopDT = 0 To dt.Rows.Count - 1
                Dim iBranchID As Integer = dt.Rows(iLoopDT)("BranchID")
                If node.Value = iBranchID Then
                    node.Checked = True
                    If node.Level = 0 Then
                        If node.CheckState = TreeNodeCheckState.Unchecked Then
                             'even though i just instructed the node to be checked,it still has unchecked status here
                        End If
                    End If
                End If
            Next iLoopDT
        Next node
    End Sub
Nikolay Tsenkov
Telerik team
 answered on 14 Jul 2011
3 answers
96 views
Hello,I have a problem,i want to get value of RadGrid2 but Radgrid2 in Radgrid1,i don't know how to get ID of radgrid with Button Click event
images : http://s1211.photobucket.com/albums/cc435/hieukenpro/?action=view&current=e.png
and this's my code
protected void Button1_Click(object sender, EventArgs e)
      {
          int count = 0;
          string sukien = "";
          string namhientai = "";           
          foreach (GridDataItem item in (How to get ID of RadGrid2 in this Event ?).SelectedItems)
          {
              foreach (GridColumn column in item.OwnerTableView.RenderColumns)
              {
                  if (count == 1 || count == 2)
                  {
                      if (count == 1)
                          sukien = item[column.UniqueName].Text.ToString();
                      if (count == 2)
                          namhientai = item[column.UniqueName].Text.ToString();
                  }
                  count++;
              }
          }
      }
Please Help Me

Thanks,
Trung Hiếu
Mira
Telerik team
 answered on 14 Jul 2011
1 answer
157 views
I have a combobox that has numbers and alpha in the same list.  I need ALL to be the first choice but when I put ascending as a sort option the numbers are above the words.  Example below:

3rd Party
2 Board
ALL
Blade
Cards
Video

Is there a way to get ALL to the top so it looks like this. (See Below)  The choices are being filled from a datasource except for ALL which is being added by using the AppendDataBoundItems= True and Text = ALL
ALL
3rd Party
2 Board
Blade
Cards
Video

Princy
Top achievements
Rank 2
 answered on 14 Jul 2011
6 answers
114 views
I specified the user control on the grid to call for update/insert/delete,  

It seems that when I click the Insert button it does call the form, but once clicking the form SUBMIT button (itemcommand = Update) , it returns to the Radgrid1_UpdateCommand()  instead of the RadGrid1_InsertCommand 


what did I do wrong

seems that once the usercontrol is called, it sets as a UPDATE instead of INSERT... 

Iana Tsolova
Telerik team
 answered on 14 Jul 2011
1 answer
66 views
Good morning, dear Telerik wizards,

Simple scenario.. RadGrid showing fine. On particular context menu click, opening via popup one of a number of DIFFERENT edit user controls. For example:
RGVMyTasksAll.MasterTableView.EditFormSettings.UserControlName = "MemberITaskDelete.ascx";
RGVMyTasksAll.MasterTableView.EditFormSettings.PopUpSettings.Width = 400;
sEditTUID = RGVMyTasksAll.Items[radGridClickedRowIndex].Cells[2].Text;
tName = RGVMyTasksAll.Items[radGridClickedRowIndex].Cells[4].Text;
RGVMyTasksAll.MasterTableView.EditFormSettings.CaptionFormatString = "Deleting Task: " + tName.ToUpper();
RGVMyTasksAll.Items[radGridClickedRowIndex].Edit = true;
ck = new HttpCookie("ITID", sEditTUID);
Response.Cookies.Add(ck);
RGVMyTasksAll.MasterTableView.AllowAutomaticInserts = false;
RGVMyTasksAll.MasterTableView.AllowAutomaticUpdates = false;
RGVMyTasksAll.Rebind();
break;
Probably don't need all of those lines in there... but when the Rebind is executed,the user control pops up just fine. This particular one is focussed on gathering adequate permissions before delete of task is authorized. Delete in this case is NOT a delete of record, but a change of status of a record... so it is really an update.

When done, I get the popup to go away by:
RadGrid rg = (RadGrid)CMFinds.FindControl(p, "RGVMyTasksAll");
rg.AllowAutomaticInserts = false; rg.AllowAutomaticUpdates = false; rg.AllowAutomaticDeletes = false;
rg.MasterTableView.AllowAutomaticInserts = false; rg.MasterTableView.AllowAutomaticUpdates = false; rg.MasterTableView.AllowAutomaticDeletes = false;
rg.MasterTableView.IsItemInserted = false;
rg.MasterTableView.ClearChildEditItems();
rg.Rebind();
My own (better for many complex situations) recursive Find Control locates the calling grid... again not sure that I need all the lines... but it closes, delete (which is change of state) is accomplished earlier, all is well.

Problem: Next time I come in to do another delete, the popup user control contains the data from the PRIOR delete, not the current one.

So two questions:
1. How can I make sure the edit control either unloads inbetween calls or resets the data properly? Important
2. What can I delete from this code as unnecessary? Just out of curiosity.

Thanks.
Chris

Mira
Telerik team
 answered on 14 Jul 2011
1 answer
68 views
Hello,

Can you provide me with guidance how to create RadGrid just like Ms Access.
Insert row is always visible under current rows and once user leaves a row in insert mode new insert row is created.

thanks


Daniel
Telerik team
 answered on 14 Jul 2011
1 answer
108 views
Hi,

I'm experiencing an issue to add a new column with several buttons there.
Found the article about how to create the item template dynamically, but all those controls are dataBind. (http://www.telerik.com/help/aspnet-ajax/grid-programmatic-creation.html)

So, I have a grid created dynamically and binded to the list of objects (some class).
All columns are created dynamically too, since I need only several class properties to be displayed.
And I need to add one more column to the end of the grid with the 2-3 buttons there and I do not see how to add them without binding to the concrete data field.
Each button's click should raise the event and I should know what exact button was pressed and from which row.

Can you please help me with this?

Thanks,
Myxville
Princy
Top achievements
Rank 2
 answered on 14 Jul 2011
0 answers
35 views
Ignore, found the solution
OzCoder
Top achievements
Rank 1
 asked on 14 Jul 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
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
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?