Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

86
Views
Telerik Griditem.getdatakeyvalue() not working for string which contains single quote

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.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!