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

[Solved] Parse error while trying to call server side method from a link button column in radgrid

1 Answer 144 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shanmuganand
Top achievements
Rank 1
Shanmuganand asked on 15 Mar 2013, 12:24 PM
Am using a radgrid. One of the columns is a Telerik:GridTemplateColumn, within which i have the asp:linkbutton. On click of the link button, i need to call a server side method, by passing the value of another column to that. But am getting a parse error. Mu code is:

<telerik:GridTemplateColumn UniqueName="Name" HeaderText="Name" SortExpression="PayeeName">
     <ItemTemplate>
          <div style="display : block; width : 100%" class="blueLinkText">
               <asp:LinkButton ID="lnkReject" runat="server" OnClick="lnkAddVendorID_Click('<%#Server.HtmlEncode(BindingHelper.Format(Eval("PayeeName")))%>')"><%# Server.HtmlEncode(BindingHelper.Format(Eval("PayeeName")))%></asp:LinkButton>
            </div>
       </ItemTemplate>
</telerik:GridTemplateColumn>

When i run this code, i get an error as "Parse Error" The server tag is not well formed.

Have anyone came across such an issue. Please let me know, how to fix this.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 18 Mar 2013, 04:58 AM
HI,

Try the following code.
C#:
protected void LinkButton1_Click(object sender, EventArgs e)
 {
        LinkButton link = (LinkButton)sender;
        GridDataItem item = (GridDataItem)link.NamingContainer;
        string value = item["Uniquename"].Text;
}

Thanks,
Shinu
Tags
Grid
Asked by
Shanmuganand
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or