GridButtonColumn CommandArgument Parameter

5 posts, 1 answers
  1. Erich
    Erich avatar
    3 posts
    Member since:
    Apr 2012

    Posted 22 Aug 2017 Link to this post

    Hi, I'm trying to pass a parameter in the GridButtonColumn's CommandArgument and CommandName field.  From what I can see in the examples, I should be able to just put in the field, like this....  CommandArgument="Part_id", however, it does not seem to pass the param back to the code behind.  I'm using the RadGrid1.ItemCommand event handler and it kicks off that event just fine.  Here is the button and the code behind and the error....

     

    <telerik:GridButtonColumn ButtonType="LinkButton" HeaderText="Additional<br />Process" CommandArgument="Part_id" CommandName="Part_id" Text="View" UniqueName="lnkPartID" DataType="System.Int32"></telerik:GridButtonColumn>                

     

    Private Sub RadGrid1_ItemCommand(sender As Object, e As GridCommandEventArgs) Handles RadGrid1.ItemCommand
            Dim partID As Integer = CInt(e.CommandArgument)
            code....code.... .code....
    End Sub

    Error...

    Input string was not in a correct format...

    The value is an integer.

    Many thanks,

    -Erich Neubert

     

  2. Erich
    Erich avatar
    3 posts
    Member since:
    Apr 2012

    Posted 24 Aug 2017 in reply to Erich Link to this post

    Nobody likes me :(
  3. Answer
    Eyup
    Admin
    Eyup avatar
    3825 posts

    Posted 28 Aug 2017 Link to this post

    Hi Erich,

    The button column has the following property:
    <telerik:GridButtonColumn ... DataTextField="OrderID">

    But for passing the field values as command argument, you should use GridTemplateColumn:
    <telerik:GridTemplateColumn DataField="ShipCountry"
        FilterControlAltText="Filter ShipCountry column" HeaderText="ShipCountry"
        SortExpression="ShipCountry" UniqueName="ShipCountry">
        <ItemTemplate>
            <asp:LinkButton ID="LinkButton1" runat="server" Text="View"
                CommandArgument='<%# Eval("OrderID") %>'></asp:LinkButton>
        </ItemTemplate>
    </telerik:GridTemplateColumn>

    I hope this will prove helpful.

    Regards,
    Eyup
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  4. Erich
    Erich avatar
    3 posts
    Member since:
    Apr 2012

    Posted 28 Aug 2017 Link to this post

    Thank you, I eventually got there.  How to I put in a feature request?  And also, under the documentation, where would I have found the information about what properties could be databound?  

     

    Thanks again.

    -Erich

     

  5. Eyup
    Admin
    Eyup avatar
    3825 posts

    Posted 31 Aug 2017 Link to this post

    Hello Erich,

    You can find the public feedback portal here:
    https://feedback.telerik.com/Project/108

    And although there is no specific section dedicated just for the databinding properties, you can check the following table:
    http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/columns/column-types#specific-properties-and-generated-controls

    Regards,
    Eyup
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top