Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

91
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda