working inside a repeater with java script..

Last post 03-20-2007 5:10 AM by etws14. 1 replies.

Sort Posts:

  • working inside a repeater with java script..

    03-20-2007, 4:33 AM
    • Loading...
    • Nitinkcv
    • Joined on 03-13-2007, 11:07 AM
    • Posts 264

    Hi,

    i have my button inside a repeater and it validates info from textboxes and ddl inside the repeater.. The prob is that i have "SELECT VALUE" chosen as the default value in my ddl. so while saving i want to check if the value in the DDL is not SELECT VALUE, then only it should save those..

    so right now my code is

     

    private void Item_Created(Object Sender, RepeaterItemEventArgs e)
            {
                if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
                {
                    Button _deleteButton = (Button)e.Item.FindControl("btnDelete");
                    _deleteButton.Attributes.Add("onclick", "return deleteUser();");

                    Button _moveUserButton = (Button)e.Item.FindControl("btnMoveUser");
                    DropDownList _dll = (DropDownList)e.Item.FindControl("lstStudyType1");
                    string _group = _dll.SelectedValue;
                    if (_group !="SELECT VALUE")
                    {
                     
                        _moveUserButton.Attributes.Add("onclick", "return moveUser();");
                    }
                    else
                    {
                        _moveUserButton.Attributes.Add("onclick", "return showAlert();");
                    }

                }

            }

     

    function showalert ()

    {

    alert('please select a value');

    return false

    }

    function moveUser()
    {

      var answer=confirm("Are you sure you want to move this candidate?");
      if(answer)
      return true;
      else
      return false;
     
    }

     

    But the code inside item_created does not work.. it even if ddl value is SELECT VALUE.. the moveUser() function is always called..

     

    so could anyone plz help.. 

     

    Thanks,

    Nitin.

    Thanks
    Filed under: ,
  • Re: working inside a repeater with java script..

    03-20-2007, 5:10 AM
    Answer
    • Loading...
    • etws14
    • Joined on 12-22-2006, 9:45 PM
    • Posts 118

    use ItemDataBound instead of using created

Page 1 of 1 (2 items)
Microsoft Communities
Page view counter