SP中如何将数据传递给lablel控制数据? [英] how to pass the data to lablel control data is in SP?

查看:74
本文介绍了SP中如何将数据传递给lablel控制数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将数据传递到标签并在UI中显示?该数据在SP中



我使用的是3层架构。在数据访问层中



设置@meassage =记录插入的SucessFully;



How to pass data to label and display in UI? That data is in SP

I used 3 tier architecture. In Data access layer

Set @meassage="Record Inserted SucessFully";

cmd.Parameters.Add("@Message", SqlDbType.VarChar, 500);
cmd.Parameters["@Message"].Direction = ParameterDirection.Output;

int result=  cmd.ExecuteNonQuery();
string outputValue = cmd.Parameters["@Message"].Value.ToString();
if (result == 1)
{
    lbloutputdata.text = outputValue;
}





这不在.aspx.cs页面中。那个代码在数据访问层



任何人帮我...



This is not in .aspx.cs page . that code is in data acess layer

Any one help me ...

推荐答案

你必须从数据访问层中的方法返回。然后只需将返回的字符串分配给Label。
You have to return that from the method in data access layer. Then just assign the returned string to the Label.


为消息框创建一个类文件

作为示例

message.cs in bll

create a class file for message box
as example
message.cs in bll
public void ShowAlertMessage(string error)
    {

        Page page = HttpContext.Current.Handler as Page;

        if (page != null)
        {

            error = error.Replace("'", "\'");

            ScriptManager.RegisterStartupScript(page, page.GetType(), "err_msg", "alert('" + error + "');", true);

        }
    }





并下单。



现在你添加你的服务器端







and place the code.

now you add your serverside


message msg = new message();

cmd.Parameters.Add("@Message", SqlDbType.VarChar, 500);
cmd.Parameters["@Message"].Direction = ParameterDirection.Output;
 
int result=  cmd.ExecuteNonQuery();
if (result >= 1)
{
    msg.Showalertmessage("Your Message!..");
}


这篇关于SP中如何将数据传递给lablel控制数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆