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

Is there any way to create a textbox for numeric password?

Thanks
Princy
Top achievements
Rank 2
 answered on 28 May 2010
1 answer
369 views

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 ObjectByVal 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 

Grid .aspx code:
<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> 
Shinu
Top achievements
Rank 2
 answered on 28 May 2010
2 answers
100 views
I am using the popup editmode to add records to a grid.  I have an unbound textbox in the edititemtemplate where the user will enter a search term, then on a button click I will be querying the database using that term.  How do I access the value entered in the textbox?  I'm using VB.

Tim
Tim
Top achievements
Rank 1
 answered on 28 May 2010
3 answers
92 views
I have an upload form that is working great in every browser I test, except for IE. The issue is that I am not using the "Select" button, but relying on the ability to "select" by clicking in the file upload field. On IE it behaves like a textbox, and just gives me a place to type text.

I see this behavior also on the demo forms, but all of those also have a select button.

Version: 2009.3.1324.20

Here is my code:

<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> 

Thanks,
Charles
Charles Kline
Top achievements
Rank 1
 answered on 27 May 2010
1 answer
86 views
Hello,

I have three resources represented by combo's... each of these uses an integer key as the key value for the resource.  In the JS API, the key is encoded???  How do I access the original key?

Thanks.
Brian Mains
Top achievements
Rank 1
 answered on 27 May 2010
1 answer
108 views
I am trying to hook a simple javascript function to update and insert link buttons on a radgrid
The Update is done - adding an attribute to the appropriate link button on the ItemDataBound event handler
the Insert button has me stumped
I am running VS 2010, .NET 4.0 and the code behind, as you can see, is VB
on Windows XP IE 8
anyway, appropriate code

<script type="text/javascript" language="javascript" >
    function ValidateRow(rowIndex) {
        var theGrid = $find("<%=rgDealerMaintenance.ClientID%>");
        var oneRow = null;
        if (rowIndex > -1) {
        oneRow = theGrid.get_masterTableView().get_dataItems()[rowIndex].get_element();
        }
     // hard coded cell locations
        for (j = 0; j < oneRow.cells[0].childNodes.length; j++) {
            var FirstName = oneRow.cells[0].childNodes[j].value;
        }
        for (j = 0; j < oneRow.cells[1].childNodes.length; j++) {
            var LastName = oneRow.cells[1].childNodes[j].value;
        }
        if (FirstName == '' || LastName == '') {
            alert('Please enter both a first name and a last name');
            return false;
        }
        return true;
    }
</script>
the grid
    <telerik:RadGrid ID="rgDealerMaintenance" AutoGenerateColumns="False"
        AllowAutomaticInserts="True" GridLines="None" ShowFooter="true" runat="server" >
    <MasterTableView CommandItemDisplay="Bottom" EditMode="InPlace" DataKeyNames="RegistrationID" HeaderStyle-CssClass="body_text_black_BOLD">
    <CommandItemSettings AddNewRecordImageUrl="Images/AddRecord.gif" AddNewRecordText="Add New" />
    <Columns>
        <telerik:GridBoundColumn DataField="RegistrationID" Visible="false" />
        <telerik:GridBoundColumn UniqueName="txtFirstName" DataField="FirstName" HeaderText="First Name">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn UniqueName="txtLastName" DataField="LastName" HeaderText="Last Name">
        </telerik:GridBoundColumn>

        <telerik:GridEditCommandColumn EditText="Edit" UniqueName="EditCommandColumn" UpdateText="Update" CancelText="Cancel" HeaderText="Edit">
        </telerik:GridEditCommandColumn>
        <telerik:GridButtonColumn CommandName="Delete" Text="Delete" HeaderText="Delete">
        </telerik:GridButtonColumn>
    </Columns>
    </MasterTableView>
    </telerik:RadGrid>

in the code behind
    Protected Sub rgDealerMaintenance_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles rgDealerMaintenance.ItemDataBound
        Dim gdItem As GridDataItem = Nothing
        Dim geItem As GridEditableItem = Nothing
        Dim btnDelete, btnUpdate As LinkButton
        Dim RowIndex As Integer
        If TypeOf e.Item Is GridDataItem Then
            gdItem = DirectCast(e.Item, GridDataItem)
            ' hard-coded location!
            btnDelete = DirectCast(gdItem.Cells(9).Controls(0), LinkButton)
            btnDelete.Attributes.Add("onclick", "return ConfirmDelete();")
        End If
        If TypeOf e.Item Is GridEditableItem And e.Item.IsInEditMode Then
            geItem = DirectCast(e.Item, GridEditableItem)
            btnUpdate = DirectCast(geItem.Cells(8).Controls(0), LinkButton)
            RowIndex = e.Item.ItemIndex
        SetLinkButtonClickEvent(btnUpdate, RowIndex)
        End If
    End Sub

    Private Sub SetLinkButtonClickEvent(ByVal btnUpdate As LinkButton, ByVal RowIndex As Integer)
        Dim sb As StringBuilder = Nothing

        If btnUpdate Is Nothing Then
            Exit Sub
        End If
        sb = New StringBuilder("return ValidateRow(")
        sb.Append(RowIndex.ToString)
        sb.Append(");")
        btnUpdate.Attributes.Add("onclick", sb.ToString)
    End Sub

how do I check for first and last name on the client in insert mode?

Marianne Seggerman




Elliott
Top achievements
Rank 2
 answered on 27 May 2010
2 answers
232 views
I'm trying to style a RADTreeView (Q1 2010)  so that:
  1. The line height is reduced so I can fit a large number of nodes in a limited area
  2. The extra space and padding on the left side of each node is removed
  3. Text wraps with the wrapping text being flush with the text above it

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-size9px !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.

James
Top achievements
Rank 1
 answered on 27 May 2010
6 answers
262 views
There appears to be a bug with the AutoFilter logic when EnableLinqExpressions is set to true.

Lets say I have a string column called "PartnerName", defined as follows:

<

 

telerik:GridBoundColumn DataField="PartnerName" DataType="System.String" HeaderText="Name"

 

 

SortExpression="PartnerName" UniqueName="PartnerName" CurrentFilterFunction="Contains"

 

 

ShowFilterIcon="false" AutoPostBackOnFilter="true" />

 



Lets say the user wants to locate a partner whose name starts with "Briar's".  They enter this text in the filter column, and hit enter.

On the back end, the filter expression is defined within the grid.MasterTableView.FilterExpression is set to:

(iif(PartnerName == null, "", PartnerName).ToString().ToUpper().Contains("briar''s".ToUpper()))

Notice that the grid has replaced the single quote in Briar's with two single quotes.  While this logic makes sense if we're sending the filter expression back to a database directly, it does not make sense when used as part of a Dynamic Linq statement, and in fact results in the query not returning any values..

There doesn't seem to be any way to work around this bug at the moment, short of some invasive string manipulation.  Is there a way to force the grid to not replace the single quote with two single quotes?


Roy
Sebastian
Telerik team
 answered on 27 May 2010
2 answers
51 views
See code below.

The SwapColumns works in all cases.

The expand logic for the group works when the swap columns does not occur.

When the swap columns logic does occur, I loose the expand value and everything is expanded.

Any ideas would be greatly appreciated.

Thanks,
Todd.

 

    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;  
        }  
 
    } 

 

 

Todd A
Top achievements
Rank 1
 answered on 27 May 2010
1 answer
110 views
We have a page in our application in which we allow for uploads of an excel file and then allow for a download of two generated excel files.  In order to make the file upload work without two postbacks we added the enctype code (Me.Page.Form.Enctype = "multipart/form-data").  This fixed the two postbacks and everything seemed to be working in IE but then we found that in Mozilla one of our download buttons was returning a scrambled excel file.  The following is part of the code that assigns the type and file extension to the generated excel file.

Private Const ExcelContentType As String = "application/vnd.ms-excel"
Private Const ExcelFileExtension As String = "xls"

Keep in mind that it completely works in IE, and that one of the buttons is working in Firefox but not the other.
Samuel Davis
Top achievements
Rank 1
 answered on 27 May 2010
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?