WEB开发网
开发学院图形图像Flash Silverlight 2 (beta1)数据操作(2)——使用ASP.NE... 阅读

Silverlight 2 (beta1)数据操作(2)——使用ASP.NET Web Service进行数据CRUD操作(下)

 2008-10-11 11:42:49 来源:WEB开发网   
核心提示: 后台代码void updateButton_Click(object sender, RoutedEventArgs e){if (userID.Text.Trim() == string.Empty){errMessage.Foreground = new SolidColorBrush

后台代码void updateButton_Click(object sender, RoutedEventArgs e)
{
  if (userID.Text.Trim() == string.Empty)
  {
    errMessage.Foreground = new SolidColorBrush(Colors.Red);
    errMessage.Text = "请输入用户ID!";
    errMessage.Visibility = Visibility.Visible;
    return;
  }
  if (userName.Text.Trim() == string.Empty)
  {
    errMessage.Foreground = new SolidColorBrush(Colors.Red);
    errMessage.Text = "请输入用户名称!";
    errMessage.Visibility = Visibility.Visible;
    return;
  }
  WebServiceProxy.UserManageSoapClient userMgrSoapClient =
    new YJingLee.WebSrv.WebServiceProxy.UserManageSoapClient();
  //调用更新用户方法
  userMgrSoapClient.UpdateUserAsync
     (Int16.Parse(userID.Text.Trim()), userName.Text.Trim());
  userMgrSoapClient.UpdateUserCompleted +=
    new EventHandler<YJingLee.WebSrv.WebServiceProxy.
      UpdateUserCompletedEventArgs>
          (userMgrSoapClient_UpdateUserCompleted);
}
void userMgrSoapClient_UpdateUserCompleted(object sender,
  YJingLee.WebSrv.WebServiceProxy.UpdateUserCompletedEventArgs e)
{
  if (e.Error == null)
  {
    errMessage.Text = "修改用户成功!";
    errMessage.Foreground = new SolidColorBrush(Colors.Blue);
    errMessage.Visibility = Visibility.Visible;
  }
  else
  {
    errMessage.Foreground = new SolidColorBrush(Colors.Red);
    errMessage.Text = e.Error.ToString();
    errMessage.Visibility = Visibility.Visible;
  }
}
删除数据部分前台界面

Silverlight 2 (beta1)数据操作(2)——使用ASP.NET Web Service进行数据CRUD操作(下)

上一页  1 2 3 4  下一页

Tags:Silverlight 数据

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接