aspx part :
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference Path="~/Models.asmx" />
</Services>
</asp:ScriptManager>
<div>
<div>
<br />
<div>
<asp:GridView ID="Gridview1" clientID="Gridview1" runat="server"></asp:GridView>
<br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div>
<input id="Button2" type="button" value="Get Model" onclick="getModelByID()" /><br />
</div>
</div>
</form>
JavaScript part:
<script type="text/javascript" language="javascript">
function getModelByID() {
_4_layer.Models.GetAllModelss(SuccesCallBack);
}
function parseJSON(data) {
return window.JSON && window.JSON.parse ? window.JSON.parse(data) : (new Function("return " + data))();
}
function SuccesCallBack(result) {
obj = parseJSON(result);
var i = document.getElementById("TextBox1");
var j = document.getElementById("GridView1");
j.DataSource = obj;
j.Bind();
}
also use
("<%= Gridview1.ClientID %>")
everything is ok with i but j returns the null object in both implementation. It's WebApp. at the beginning the Gridview1 is empty so it doesn't show and no html object creates for it to use the Dom object. what can I do ? with out Jquery!