|
I havent got ans in ASP discussions :
Hi,
I have used this code to change the cell value :
<script type="text/javascript">
function Open(IdNeed)
{
var grid = document.getElementById('<%=gvEstelam.ClientID%>');
grid.rows[1].cells[4].innerHTML = 152;
alert(grid.rows[1].cells[4].innerHTML);
}
the alert show that the "grid.rows[1].cells[4]" value has changed to 152 and also in gridview it changed
BUT
when i click on OK button of alert then the value is change same as before(ex.500).
How to set the new value to remain ?
And this is my cell code :
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="ImageEstelamBuyingKala" ImageUrl="~/ServerFile/ApplicationFiles/Icons/Button/add.png"
Width="25" runat="server" OnClientClick='<%# " Open("+ DataBinder.Eval(Container.DataItem,"Id") + ");" %>' />
</ItemTemplate>
</asp:TemplateField>
|
|
|
|
|
jojoba2011 wrote: How to set the new value to remain ?
It looks like you are having a postback after the OnClientClick method. On server side, you must be rebinding the grid and thus old data remains. Just put a debugger on server side and see for yourself.
To avoid the postback, truncate the request at client side itself post calling Open method, like:
OnClientClick='<%# " Open("+ DataBinder.Eval(Container.DataItem,"Id") + ");" %> return false;'
|
|
|
|