查看活动用户数据 [英] to view active users data

查看:84
本文介绍了查看活动用户数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下表emp_details数据



emp_id名称地址州活跃

1 raj bangalore kar是

2 ravi kochchin kerala no

3 peter hyd ap yes

4 ram mysore kar no



i made 2这个概念中的页面,

首页Emp_Register。

注册后我需要活跃用户(active = yes)在下一页,带名称和视图按钮(所有活动用户都有不同的视图按钮),如果点击名称,则显示所有数据这个名字。



请打电话给任何人



谢谢..

The below table emp_details with data

emp_id name address state active
1 raj bangalore kar yes
2 ravi kochchin kerala no
3 peter hyd ap yes
4 ram mysore kar no

i made 2 pages in this concept,
First page Emp_Register.
after the registration i need active users( active=yes) in the next page, with name and view button(all active users with different view buttons), if click the name , it shows all data according to the name.

Please tel anybody

thank you..

推荐答案

好的,继续吧!你的概念看起来不错。



看,你必须告诉我们,你到目前为止尝试了什么,你在哪里被困住。 />
没有它就有点难以帮助。



发布你的代码..
Okay, go ahead.! Your concept seems nice.

See, you have to show us, what have you tried so far and where are you stuck.
Without that it is bit difficult to help.

Post your code..


你可以创建显示名称和按钮的列表视图。

使用linq查询,您可以根据ID命名并在文本中显示用户名称



You can create a list view to display the names and buttons.
Using a linq query you can name then according to the ID and display the user's name in text

private void Page_Load(object sender, System.EventArgs e)
{
    if (!IsPostBack)
        AddControls();
}

protected override void LoadViewState(object savedState)
{
    base.LoadViewState(savedState);
    if (ViewState["controsladded"] == null)
    AddControls();
}

private void AddControls()
{
    int count = 0;

    for(i = 0; i < LinqQuery(true).count; i ++)
    {
        TextBox dynamictextbox = new TextBox();
        dynamictextbox.Text = LinqQuery(true)[i].name);
        dynamictextbox.ID = string.Format("txtPerson{0}"LinqQuery(true)[i].ID);
        Button dynamicbutton = new Button();
        dynamicbutton.Click += new System.EventHandler(string.Format("dynamicbutton{0}_Click", LinqQuery(true)[i].ID);
        dynamicbutton.Text = "Dynamic Button";
        Panel1.Controls.Add(dynamictextbox);
        Panel1.Controls.Add(new LiteralControl("<br>"));
        Panel1.Controls.Add(new LiteralControl("<br>"));
        Panel1.Controls.Add(dynamicbutton);
    }
    
    ViewState["controlsadded"] = true;
}

private void dynamicbutton_Click(Object sender, System.EventArgs e)
{
    for(i = 0; i < LinqQuery(true).count; i ++)
    {
        TextBox tb = new TextBox();
        tb = (TextBox) (Panel1.FindControl(string.Format("txtPerson{0}"LinqQuery(true)[i].ID)));
        Label1.Text = tb.Text;
    {
}

private void LinqQuery (bool active)
{
    if (active)
        var queryAllCustomers = from tbl in emp_details
                                select tbl
                                where tbl.active = 'yes';
    
    return queryAllCustomers; 
}
</br></br>





现在编码部分我可能会建议查看这个 [ + ]并决定你pon如何改变上面的代码以获得正确的结果。希望这会有所帮助: - )



Now for the coding part I might suggest looking at this[+] and deciding upon how to alter the above code to get the correct results. Hope this helps :-)


这篇关于查看活动用户数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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