im using Asp.net Telerik Rad Gridview and need to get a string value that contains single quotes. if the string contains single quote, this method is failing and failed to trigger the javascript method which is in this action. below is the code,
<telerik:RadGrid ID="grid_PastPositions" OnNeedDataSource="grid_PastPositions_NeedDataSource" Width="100%" runat="server" AutoGenerateColumns="false" ClientSettings-Scrolling-AllowScroll="true">
<ClientSettings EnableRowHoverStyle="true" Scrolling-ScrollHeight="200px"></ClientSettings>
<MasterTableView CommandItemDisplay="None" DataKeyNames="ID,Note,Type" CommandItemSettings-AddNewRecordText="Create A New Team" EditMode="PopUp">
<NoRecordsTemplate>
<b>No records found</b>
</NoRecordsTemplate>
<Columns>
<telerik:GridDateTimeColumn DataField="Note"HeaderText="Notes" HeaderStyle-Font-Bold="true" />
<telerik:GridTemplateColumn>
<ItemTemplate>
<%#"<a onclick='" +( ((string)((Container as GridDataItem).GetDataKeyValue("Type")) == "Additional")? ("showAdditionalPositionNoteEdit("+ (Container as GridDataItem).GetDataKeyValue("ID")+ ",\""+(Container as GridDataItem).GetDataKeyValue("Note")+"\")"): ("showDialog2("+ (Container as GridDataItem).GetDataKeyValue("ID")+ ",\""+(Container as GridDataItem).GetDataKeyValue("Note")+"\")")) + ";return false;'>Edit Notes</a>"%>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
the problem is in this line
(Container as GridDataItem).GetDataKeyValue("Note")+"\")
here the "Note" string is like this in database. 'this is kevin's note' . so if the string contains a single quote (above : kevin's) , then this javascript method showDialog2() is not firing. if I change the string without single quote like this. 'this is kevins note' . then its working.
I need to fire this javascript even the string value in db contains single quotes.