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.