protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { TextBox txtpid = e.Row.FindControl("txt_pid") as TextBox; DropDownList txtpname = e.Row.FindControl("txt_pname") as DropDownList; //product name is dropdown TextBox txtpsize = e.Row.FindControl("txt_psize") as TextBox; txtpname.Attributes.Add("onChange", "javascript: return getEmpName('" + txtpid.ClientID + "','" + txtpname.ClientID + "','" + txtpsize.ClientID + "')"); } }
<script type="text/javascript" language="javascript"> function getEmpName(id,name,size) { $.ajax({ type : "POST", url : "Getempname.aspx?prod_name=" + $("#name").attr("value"),//Here am getting value of "name" is Undefined success : function(reponseText) { var s = reponseText.toString(); var temp = new Array(); temp = s.split(" "); document.getElementById(id).value = temp[0]; document.getElementById(size).value = temp[1]; } }); } </script>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)