boycoto

boycoto

  • NA
  • 147
  • 124.8k

Select Item on a LookUp

Apr 24 2013 1:57 AM
Can anyone help me on how to select
a record on a jquery dialog and pass the
value to a textbox on Page1. I am using
function SelectGrid to pass the value, but
is not working.

Page1.aspx
[code]
        $(document).ready(function() {
            $("#btnLookUp").click(function() {
                $("#searchActor").dialog({
                    autoOpen: "false",
                    resizable: "false",
                    height: "250",
                    width: "320"
                });
            });
        });

        $(document).ready(function() {
            $("#btnSearch").click(function() {
                $("#actorsList").load("LookUp/ActorsList.aspx", { lname: $("#txtSearchCriteria").val() });
            });
            return false;
        });

        function SelectGrid(objValue, itemValue , popUpDialog) {
            $(objValue).val(itemValue);
            $(popUpDialog).dialog("close");                       
        }
[/code]

ActorsList.aspx Codebehind

[code]
private void LoadActors(string param)
        {
            DataTable dt = new DataTable();
            //Execute stored proc

            Response.Write("<table>");
            foreach (DataRow dr in dt.Rows)
            {
                Response.Write("<tr>");
                Response.Write("<td>" + "<label onclick='SelectGrid(#txtActorId,0,#searchActor'>Select</label>" + "</td>");
                Response.Write("<td>" + dr[2].ToString() + "</td>");
                Response.Write("<td>" + dr[3].ToString() + "</td>");
                Response.Write("<td>" + dr[4].ToString() + "</td>");
                Response.Write("</tr>");
            }
            Response.Write("</table>");
        }
[/code]