<A href = javascript: deletebyid ('<% # eval ("ID") %>');> </a>
Function deletebyid (ID)
{
If (confirm ("are you sure you want to delete it? "))
{
VaR result = _ deault. Delete (ID); // call the background Ajax
If (result)
{
Document. Forms [0]. Submit ();
}
Else
{
Alert ("deletion error! ");
}
}
}
========================================================== ====================================
<A href = javascript: getbyid ('<% # eval ("ID") %>');> </a>
Function getbyid (ID)
{
VaR result = _ deault. getbyid (ID); call Ajax in the background to obtain the data to be edited.
VaR drptype =$ ("# <% = drptype. clientid %>") [0];
For (VAR I = 0; I <drptype. Options. length; I ++)
{
If (drptype. Options [I]. value = result. value. wordtype)
{
Drptype. Options [I]. Selected = true;
Break;
}
}
$ ("# <% = Txtid. clientid %>"). Val (result. value. ID );
$ ("# <% = Txtcontent. clientid %>"). Val (result. value. wordcontent );
$ ("# <% = Btnsave. clientid %>") [0]. Disabled = false;
}
Common JS Code
Function format_type_name (ID)
{
VaR DRP = Document. getelementbyid ('<% = drptype. clientid %> ');
For (VAR I = 0; I <DRP. Options. length; I ++)
{
If (DRP. Options [I]. value = ID)
{
Return DRP. Options [I]. text;
}
}
Return '';
}