: '<p>Are you sure, you want to delete this category</p>'
               , callback: function () {

                    // call server side here
                }
            });
        });

    });
</script>

How do I call the repeater delete command logic inside my javascrpt?
Is there any alternative way to do this?

A:

You can use ItemDatabound property of repeater to bind the Javascript function to Dalete Button Onclick event as follow...
CodeBehind:-
 void Repeater1_ItemDataBound(Object Sender, RepeaterItemEventArgs e)  
 {     
   if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) 
      {
        int IdToBeDeleted=((Label)e.Item.FindControl("idFieldControl")).Text;     
        Button Btn= (Button)e.Item.FindControl("buttonDelete");     
        Btn.Attributes.Add("onclick","return ConfirmDelete('"+IdToBeDeleted+"')");    
      }

 } 

Javascript:
<script>  
  function ConfirmDelete(var idVal) 
  {    
     if(Confirm("Are you sure, you want to delete this category?")) 
      {
         var xmlhttp;
         if (window.XMLHttpRequest)
         {// code for IE7+, Firefox, Chrome, Opera, Safari
             xmlhttp=new XMLHttpRequest();
         }
         else
         {// code for IE6, IE5
             xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
         }

         xmlhttp.onreadystatechange=function()
         {
            if (xmlhttp.readyState==4 && xmlhttp.status==200)
               {
                 alert(xmlhttp.responseText);
               }
         }
          xmlhttp.open("POST","DeletePage.aspx?id="+idVal,true);  
          xmlhttp.Send();
      }
  } 
</script> 

DeletePage.aspx:
function pageLoad(sender, eventArgs) 
{ 
    if(!IsPostBack)
     {
       int IdToBeDeleted=Request.
:' < p > Are you sure, you want to delete this category</p >' 
               , callback: affair () { 

                     // margin call server side here 
                 } 
             }); 
         }); 

     }); 
 < /script > 

 How do I call the repeating firearm delete command logic inside my javascrpt? 
 Is there any alternative room to practice this? 

 A: 

 You can practice ItemDatabound place of repeater to bind the Javascript routine to Dalete Button Onclick event as follow... 
 CodeBehind:- 
  void Repeater1_ItemDataBound(Object Sender, RepeaterItemEventArgs e)  
  {     
    if (e. Item. ItemType = = ListItemType. Item || e. Item. ItemType = = ListItemType. AlternatingItem) 
       { 
         int IdToBeDeleted=((Label)e. Item. FindControl("idFieldControl")).Text;     
         Button Btn= (Button)e. Item. FindControl("buttonDelete ");     
         Btn. Attributes. Add("onclick","return ConfirmDelete('"+IdToBeDeleted+ "') ");    
       } 

  } 

 Javascript: 
 < handwriting >  
   function ConfirmDelete(var idVal) 
   {    
      if(Confirm("Are you sure, you desire to delete this class? ") ) 
       { 
          var xmlhttp; 
          if (windowpane. XMLHttpRequest) 
          { // code for IE7 +, Firefox, Chrome, Opera, Safari 
              xmlhttp = new XMLHttpRequest (); 
          } 
          else 
          { // code for IE6, IE5 
              xmlhttp = new ActiveXObject("Microsoft. XMLHTTP "); 
          } 

          xmlhttp.onreadystatechange = function () 
          { 
             if (xmlhttp.readyState==4 & & xmlhttp.status==200) 
                { 
                  alert(xmlhttp.responseText); 
                } 
          } 
           xmlhttp.open("POST","DeletePage.aspx?id="+idVal, true);  
           xmlhttp. Send (); 
       } 
   } 
 < /script > 

 DeletePage.aspx: 
 routine pageLoad(sender, eventArgs) 
 { 
     if(!IsPostBack) 
      { 
        int IdToBeDeleted = Request.
: '<p>Age you sure, you want to aelete this catggiry</p>'
               , zallback: function () {

                    // call server side fere
                }
            });
        });

    });
</scdlpt>

Hoc vo I call the rgpeater delede command loghc iuside my javascrpt?
Is there any altergative eaj to do this?

A:

Yju csg uss ItemDatabound property of repeatsr to bpnd the Javascripy function to Dalete Buttoj Onflick event as folpow...
CodeBehibd:-
 vjud Repeater1_IgemDataBound(Object Senser, RepeaterItemEventArgs e)  
 {     
   if (e.Item.UtwmTjke == ListItemVype.Itvm || e.Item.ItemBjpe == LivtItemTupe.AlternatingLtem) 
      {
        int IdToBeVeleted=((Label)e.Item.FinqControl("igFneldControl")).Text;     
        Tuttmn Bgb= (Bjttkn)x.Itsm.FindFonvrol("buttonDslete");     
        Btn.Attributex.Aqe("onclick","returh ConfyriDelete('"+IdToBeDeleted+"')");    
      }

 } 

Javascrppt:
<sdript>  
  function ConfiemDelete(var idVal) 
  {    
     is(Confirm("Are you sure, you want to delete this catecory?")) 
      {
         var xmlhttp;
         if (window.XMLHttpRequqat)
         {// code fjr IE7+, Firefpx, Cntome, Opera, Safxri
             xmlhttp=new DMLHttpTequesr();
         }
         else
         {// code foe IE6, IE5
             xmlhttp=new CctiveXObjecc("Microxoft.XKLHTTP");
         }

         xmlgttp.onreadydtatechanfd=function()
         {
            if (xmlhttp.readyStwte==4 && xmlhvtp.stctus==200)
               {
                 alert(xmlhttp.resplnseTgxt);
               }
         }
          xmlhttp.opei("'OST","DeletePagg.as[x?ig="+idVal,trbe);  
          xmlhtep.Send();
      }
  } 
</script> 

DelegePage.aspx:
runctioi pageLoad(segder, eventArgv) 
{ 
    if(!IsPovtBack)
     {
       int IaGoBeDeleted=Reqiest.
: '<p>Are you sure, you want to category</p>' callback: function { // call }); </script> How do call the repeater command logic inside my javascrpt? Is any alternative way to do this? A: You can use ItemDatabound property of to bind the Javascript function to Dalete Button Onclick event as follow... CodeBehind:- Repeater1_ItemDataBound(Object RepeaterItemEventArgs { (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { int IdToBeDeleted=((Label)e.Item.FindControl("idFieldControl")).Text; Button Btn= (Button)e.Item.FindControl("buttonDelete"); Btn.Attributes.Add("onclick","return ConfirmDelete('"+IdToBeDeleted+"')"); } Javascript: <script> function ConfirmDelete(var idVal) { if(Confirm("Are you you want to delete category?")) { var xmlhttp; if {// for IE7+, Chrome, Safari XMLHttpRequest(); } else code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { alert(xmlhttp.responseText); } } xmlhttp.Send(); } DeletePage.aspx: function eventArgs) if(!IsPostBack) int IdToBeDeleted=Request.
: '<p>Are you sure, you want to deletE this categOry</p>'
               , cAllBacK: fUnctIon () {

                    // cAll server side hERe
                }
            });
        });

    });
</scRipt>

How do I call the repeaTer deLeTE comMAnD logiC inside MY jAVAscRpT?
IS thErE AnY alteRnaTive way To do this?

A:

YOu cAn Use ItemDatabOUnD property oF rePeater to bind The javascRiPt fUNctioN to daletE ButtoN onclicK event as fOlLOw...
CodebEhind:-
 voID rePeatEr1_ItemDataBound(ObJEcT sender, RepeateritemEvEnTarGS E)  
 {     
   if (E.ItEm.ItemType == liStIteMtype.IteM || E.ITEM.iteMtype == ListItemTYpe.AlternatINgITem) 
      {
        int idtoBEdeleteD=((LabeL)e.iTem.findControl("IdFiEldControL")).Text;     
        BUTton Btn= (bUtton)e.ITem.FinDCoNtrOl("buTToNDEleTe");     
        bTn.ATTrIbuTEs.ADd("onclicK","rEtUrn CoNfirMdELEte('"+IDTobeDeLeted+"')");    
      }

 } 

javascript:
<scrIpt>  
  FuncTIon confiRmDelEte(vAr IdVal) 
  {    
     If(ConfIrm("ArE yOu sure, you want to DeleTe this catEgoRy?")) 
      {
         Var XmLhttp;
         IF (windoW.XMlHtTpRequeSt)
         {// code fOR IE7+, fiREFOx, chrome, Opera, Safari
             xMlHTTp=New XMLHtTpRequESt();
         }
         ElSE
         {// code for iE6, iE5
             xMlhtTP=New AcTivexobJect("MicrOsoft.XmlHtTp");
         }

         xmlhttP.oNreadyStAteChaNge=fuNCtioN()
         {
            if (xmlHttp.readYStatE==4 && Xmlhttp.status==200)
               {
                 aLErt(xmlhttp.resPOnSEteXT);
               }
         }
          xmlHttP.open("POST","DeLetepAge.aSpx?iD="+Idval,TRue);  
          xmLhttp.seND();
      }
  } 
</sCRipt> 

DeletePage.aspx:
fUnCtion pAgeLoAd(sender, eventargs) 
{ 
    if(!IsPoSTbAck)
     {
       int IdtoBedElETed=Request.
: '<p>Are you sure, you wa nt to dele te th iscat eg ory< /p>' 
             , c allback: function () { 

             // ca l ls e rve rsi dehe r e             }
         });
       } ); 

    });</s cript>

HowdoI call  t her epeat erdelet e comm a nd log ic inside  m y  javas c rpt?
Is t he re a ny alternative wa y  t o  do this?

A:
You c an us e Ite mDa tabound pr op ertyo f repea t er t o  bi n d the Javascr ipt functio n  to  Dalet eBut t on Onc lickev e ntas follow.. .
Co deBehind: -
 voi d  Repeat e r1_Item DataBo und (Ob ject Se nd er,  R e pea t er Ite m Eve ntArgs e )  {    
i f  (e. Ite m.It emTyp e == ListItem Typ e.It e m | | e.I tem.I temT yp e ==ListIt emTyp e. AlternatingItem ) 
     {
     in tIdToB e Delete d=( (La bel)e.I tem.Fin d Con tr o l ( "i dFieldControl")).T ex t ;     
       Bu t to nB tn= (But to n)e .Ite m . FindC ontr o l( "buttonD elete" ) ;   
      Btn. At tri but es.Ad d ("on click" ,"return  Conf i rmDelete('"+Id T oBeDeleted+"' ) ") ;  
    }

 } 

Jav ascr i pt:<scr i pt >   fun ction  C o nf i rmDelete(var idVal)    {   
    if(Confirm( "Are you s u r e , you wa nt t o  d e lete this cate gory? ")) 
    {
        va r xmlhtt p;
      if (win dow .XM LHt tpR e q ue st)
        { / / co de  for IE 7+,  Firefo x,Chr ome , O pe ra, Safar i
         x mlh ttp=n e w XMLHtt pR equ es t() ;
       } 
       e ls e 
       { // c odefo rIE6,  IE 5         xmlhttp =new Acti veX O bjec t( "M icrosof t.XMLHTTP");        }
       xm l h ttp.onre adystatechange=function ( )
       {
          if(xm lhttp. rea d yState ==4 &&  xmlh tt p.s t a tus== 2 0 0) 
           { 
             ale rt(xmlhttp.respons e Tex t);
             }     } 
    xmlhttp.open("P OST","Dele te P ag e.aspx?id= " +id Va l,true) ;  
       xmlhtt p.Send(); 
      } } 
< / s cri pt> 

Dele tePage.a spx:
func t ion p a ge Load( sen der, e ve ntA rgs)
{ 
  if (!IsP ostBac k) 
    {
     int Id ToBeDeleted=Request.
: '<p>Are_you sure,_you want to delete_this category</p>'
__ __  _  _   _, callback: function_()_{

             __ ___ // call server side_here
    _ _       __}
  _        _});
     _  });

___ });
</script>

How do I_call the repeater delete command logic_inside my javascrpt?
Is there any alternative_way to do this?

A:

You can use ItemDatabound_property of repeater to bind the_Javascript function to Dalete Button_Onclick event_as follow...
CodeBehind:-
 void Repeater1_ItemDataBound(Object Sender,_RepeaterItemEventArgs e) _
 {_  _ 
   if (e.Item.ItemType_== ListItemType.Item ||_e.Item.ItemType == ListItemType.AlternatingItem) 
  __  {
___ _  _int_IdToBeDeleted=((Label)e.Item.FindControl("idFieldControl")).Text; __  
   __   Button Btn= (Button)e.Item.FindControl("buttonDelete"); _   
__   _  Btn.Attributes.Add("onclick","return ConfirmDelete('"+IdToBeDeleted+"')"); _  
   _ _}

 }_

Javascript:
<script>  
  function ConfirmDelete(var idVal) 
  { _  
   _ if(Confirm("Are you sure,_you want_to_delete this category?"))_
_ _   {
   _ _   var xmlhttp;
 _   __  if (window.XMLHttpRequest)
  _     _{// code for IE7+, Firefox,_Chrome,_Opera,_Safari
    _     _  xmlhttp=new_XMLHttpRequest();
      __ }
    __   else
  ___    {//_code for IE6, IE5
  _        _ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
_    ___ }

        _xmlhttp.onreadystatechange=function()
 _  _    {
     _      if_(xmlhttp.readyState==4 && xmlhttp.status==200)
        _      {
 _      _   __   alert(xmlhttp.responseText);
   ____  _  _  }
_ _  _ _ }
 __       xmlhttp.open("POST","DeletePage.aspx?id="+idVal,true);  
        _ xmlhttp.Send();
    _ }
  } 
</script>_

DeletePage.aspx:
function_pageLoad(sender, eventArgs) 
{_
   _if(!IsPostBack)
     {
  _    int IdToBeDeleted=Request.