Click here to Skip to main content
13,045,564 members (69,456 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


1 bookmarked
Posted 24 Jul 2012

Localizing JQuery Dialog Button

, 24 Jul 2012
Rate this:
Please Sign up or sign in to vote.
Localizing JQuery Dialog Button


JQuery dialog box provides a way for the developers/designers to show useful information to the application users. Information to be shown in dialog is the content within DIV element. Content within the DIV can change based on the culture info. But, how do we change the text within the dialog buttons. This tip provides one of the ways to do it.

Using the Code

Value for the OK button is retrieved from the resource file and stored in a hidden variable.

<form id="form1" runat="server">
<asp:Button ID="Button1" runat="server" Text="Click" />
<asp:HiddenField ID="lblOK" runat="server" Value="<%$ Resources:Resource, OK %>">
<div id="dialog">
Some information to the user through dialog

Text value of the button is initialized with the value of lblOK hidden variable.

<script language="javascript">
$(document).ready(function () {
okValue = $('#<%=lblOK.ClientID%>').val();
var $dialog = $('#dialog').dialog({ autoOpen: false, title: 'My Dialog', buttons: [
 text: okValue,
 click: function () { $(this).dialog("close"); }

$('#<%=Button1.ClientID%>').click(function () {
return false;

Points of Interest

This is just one of the ways of doing it. There could be multiple ways to do it and I would be interested in knowing any other way.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Manjunath Shrikantiah
India India
9+ plus years of experience in IT industry. This includes experience in architecting, designing and developing solutions on Web and desktop application platforms

You may also be interested in...

Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170713.1 | Last Updated 24 Jul 2012
Article Copyright 2012 by Manjunath Shrikantiah
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid