We often use modal dialog to display list item or other infomation in sharepoint.we can use the following code to create a modal dialog:

1 <script type="text/javascript">
2 function ShowInfo() {
3 var options = SP.UI.$create_DialogOptions();
4
5 options.title = "ModalDialogTitle";
6 options.width = 800;
7 options.height = 400;
8 options.url = "/_layouts/***.aspx";
9
10 SP.UI.ModalDialog.showModalDialog(options);
11 }
12 </script>
Most of the time,we need to pass one or more parameters to it,so we change the code like this:

1 <script type="text/javascript">
2 function ShowEmpInfo(para, title) {
3 var options = SP.UI.$create_DialogOptions();
4
5 options.title = title;
6 options.width = 800;
7 options.height = 400;
8 options.url = "/_layouts/***.aspx?para=" + para;
9
10 SP.UI.ModalDialog.showModalDialog(options);
11 }
12 </script>
But how to pass these parameters,we can do it like this.
Suppose that we have a button,and we want to click it to show the special infomation,pass its ToolTip property to the parameter "para" and Text property to "title",we can add a "OnClick" event to this button,and write the following code to the code behind:

1 protected void btn_OnClick(object sender, EventArgs e)
2 {
3 btn_Info_onclick(((Button)sender).ToolTip, ((Button)sender).Text, (Button)sender);
4 }
5
6 protected void btn_Info_onclick(string para, string title, Button btn)
7 {
8 // create ECMAScript to call the dialog function and pass the parameters
9 var script = string.Format(@"ShowEmpInfo('{0}','{1}'); ", para, title);
10 // run the script
11 ScriptManager.RegisterStartupScript(btn.Page, this.GetType(), "onekey", script, true);
12 }