The problem is a fairly straight foward one, or so I thought. On the ItemDatabound event, I need to check the value of a certain column of the DataItem. If the data starts with "PTC" then I need to change the data for that column to read "New Order" instead. I thought I had it figured out, but it didn't work. I am assuming it's a simple fix, if someone can take a quick look at it. Here's the codebehind;
| Private Sub rgPoOrders_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles rgPoOrders.ItemDataBound |
| Dim TrackURL As String |
| Dim Track As New PackageTrack |
| If TypeOf e.Item Is GridDataItem Then |
| Dim item As GridDataItem = DirectCast(e.Item, GridDataItem) |
| Dim TrackNum As String = String.Empty |
| Dim SubmittedBy As String = String.Empty |
| 'assign tracking number to variable |
| If item.OwnerTableView Is rgPoOrders.MasterTableView Then |
| TrackNum = item("cshortrmk").Text |
| SubmittedBy = item("SubmittedBy").Text |
| End If |
| 'Get URL for tracking number |
| TrackURL = Track.Track(TrackNum) |
| 'Set Hyperlink variable/control, and URL to hyperlink control |
| 'NOTE: UPS has to open separate browser window. |
| Dim TrackButton As HyperLink = DirectCast(item("hlTrackButton").Controls(0), HyperLink) |
| TrackButton.NavigateUrl = TrackURL |
| TrackButton.Target = "_blank" |
| 'Get Submitted by column, substitute .txt files for data |
| If SubmittedBy.StartsWith("PTC") = True Then |
| SubmittedBy = "New Order" |
| End If |
| End If |
| End Sub |
| <telerik:RadGrid ID="rgPoOrders" runat="server" DataSourceID="dsPurchaseOrders" |
| GridLines="None" AllowFilteringByColumn="True" AllowPaging="True" |
| AllowSorting="True" PageSize="25"> |
| <MasterTableView ItemStyle-HorizontalAlign="Center" AutoGenerateColumns="False" |
| Width="95%" DataKeyNames="cpono" DataSourceID="dsPurchaseOrders" |
| GridLines="Horizontal" AlternatingItemStyle-HorizontalAlign="Center" |
| HeaderStyle-HorizontalAlign="Center" PagerStyle-PageButtonCount="15"> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px" /> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px" /> |
| </ExpandCollapseColumn> |
| <Columns> |
| <telerik:GridBoundColumn DataField="cpono" HeaderText="PO #" ReadOnly="True" |
| SortExpression="cpono" UniqueName="cpono"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="cconfirmto" HeaderText="Submitted By" |
| ReadOnly="true" UniqueName="SubmittedBy" > |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="DateOnly" DataType="System.DateTime" |
| HeaderText="Date Submitted" SortExpression="DateOnly" UniqueName="DateOnly"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="cshortrmk" HeaderText="Tracking #" |
| UniqueName="cshortrmk"> |
| </telerik:GridBoundColumn> |
| <telerik:GridHyperLinkColumn Text="Click Here To Track" HeaderText="" |
| UniqueName="hlTrackButton"> |
| </telerik:GridHyperLinkColumn> |
| </Columns> |
| <ItemStyle HorizontalAlign="Center" /> |
| <AlternatingItemStyle HorizontalAlign="Center" /> |
| <HeaderStyle HorizontalAlign="Center" /> |
| </MasterTableView> |
| </telerik:RadGrid> |
| <form id="form1" runat="server"> |
| <telerik:RadScriptManager ID="ScriptManager" runat="server" /> |
| <telerik:RadProgressManager ID="Radprogressmanager1" runat="server" /> |
| <telerik:RadUpload ID="RadUpload1" runat="server" onclientadded="increaseFileInputWidth" EnableEmbeddedSkins="false" EnableFileInputSkinning="true" Localization-Clear="" ControlObjectsVisibility="ClearButtons" /> |
| <asp:ImageButton ID="btnUpload" runat="server" ImageUrl="Images/Buttons/106x26UploadPDF.png" /> |
| </form> |
I'm very close but the text wrap isn't working correctly. When the text wraps, it overlaps with other items in the tree. See the screen shot - I've highlighted the problem with a red box.
Here is the css I've hacked my way into:
| .refinementTreeView .rtLI .rtTop, |
| .RadTreeView .rtLI .rtMid, |
| .RadTreeView .rtLI .rtBot |
| { height:13px !important;} |
| .RadTreeView .rtUL |
| { padding-top:0px !important; margin-top:0px !important;} |
| .RadTreeView .rtUL .rtUL |
| { padding-top:0px !important; margin-top:0px !important; padding-bottom:0px !important; margin-bottom:0px !important; white-space:normal !important;} |
| .treeView_NoChilds { padding: 0 !important; font-size: 9px !important;} |
.treeView_NoChilds is being applied in the code behind to each tree node via the ContentCssClass property.
The tree itself is inside a div which is inside a table cell with a fixed width. The tree in the aspx is defined as:
| <telerik:RadTreeView ID="treeViewProduct" runat="server" ShowLineImages="False" AppendDataBoundItems="True" DataFieldID="ID" DataFieldParentID="ParentID" > |
Each node is output as a html hyperlink for the product name and text as the count. Any help would be appreciated. Thanks.
<
telerik:GridBoundColumn DataField="PartnerName" DataType="System.String" HeaderText="Name"
SortExpression="PartnerName" UniqueName="PartnerName" CurrentFilterFunction="Contains"
ShowFilterIcon="false" AutoPostBackOnFilter="true" />
| protected void ScheduleGrid_PreRender(object sender, EventArgs e) |
| { |
| //Swap |
| if (divisionObj.SwapHomeAndAway) |
| ScheduleGrid.MasterTableView.SwapColumns("Home", "Away"); |
| //Expand/Collapse groups |
| ArrayList groupItems = new ArrayList(ScheduleGrid.MasterTableView.GetItems(GridItemType.GroupHeader)); |
| foreach (GridGroupHeaderItem item in groupItems) |
| { |
| bool expanded = false; |
| ArrayList childItems = new ArrayList(item.GetChildItems()); |
| foreach (GridItem child in childItems) |
| { |
| RadComboBox rcb = (RadComboBox)child.FindControl("DispositionComboBox"); |
| if (rcb != null && rcb.SelectedValue != "") |
| { |
| if (Convert.ToInt32(rcb.SelectedValue) == DispositionTypes.PENDING) |
| { |
| expanded = true; |
| break; |
| } |
| } |
| } |
| item.Expanded = expanded; |
| } |
| } |