This is a migrated thread and some comments may be shown as answers.

GridButtonColumn CommandArgument Parameter

5 Answers 1124 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Erich
Top achievements
Rank 1
Erich asked on 22 Aug 2017, 11:34 PM

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

 

5 Answers, 1 is accepted

Sort by
0
Erich
Top achievements
Rank 1
answered on 25 Aug 2017, 12:46 AM
Nobody likes me :(
0
Accepted
Eyup
Telerik team
answered on 28 Aug 2017, 06:17 AM
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.
0
Erich
Top achievements
Rank 1
answered on 28 Aug 2017, 06:23 PM

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

 

0
Eyup
Telerik team
answered on 31 Aug 2017, 02:54 PM
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.
0
Marcos
Top achievements
Rank 1
answered on 07 Nov 2019, 04:31 PM
<Telerik:GridButtonColumn ButtonType="linkButton" CommandName="Assign" UniqueName="Assign" />
protected void rdUncategorized_ItemDataBound(object sender, GridItemEventArgs e)
{
     if(e.Item is GridDataItem)
     {
          GridDataItem item = e.Item as GridDataItem;
          string msgId = "anyValue";
          LinkButton btnA = item["btnAssign"].Controls[0] as LinkButton;
          btnA.CommandArgument = msgId;
     }
}
Tags
Grid
Asked by
Erich
Top achievements
Rank 1
Answers by
Erich
Top achievements
Rank 1
Eyup
Telerik team
Marcos
Top achievements
Rank 1
Share this question
or