Click here to Skip to main content
15,912,457 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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..
Posted
Comments
sharat naik 24-Jan-14 1:13am    
i have send the concept is sample, my code length is very high ...

previous concept -- after the insertion active users data i need, one textbox and one button,
like name and view , if i click view it shows that user details..

piz send me any related topic

thank you
sharat naik 25-Jan-14 0:21am    
Good morning dear sir,
Here i am getting error for belove code, sir can send me the working

example with design code. because i am a fresher sir..


design::

<asp:Panel ID="Panel1" runat="server">

<asp:ListView ID="ListView1" runat="server">

<asp:Label ID="Label1" runat="server"

Text="Label">


..................................................................................................
cs code...


using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using System.Text;


namespace Heavy_Water_management_System
{
public partial class Mo_4D_Details : System.Web.UI.Page
{
int i=0;
var queryAllCustomers;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (!IsPostBack)
AddControls();
Grd1();

}

}
string connection =

ConfigurationManager.ConnectionStrings["HWMSConnectionString"].ToStri

ng();

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 ++)//ERROR--OPERATOR '.'CAN

NOT BE APLLIED TO OPERAND TYP OF VOID
{
TextBox dynamictextbox = new TextBox();
dynamictextbox.Text = LinqQuery(true)[i].name);//CAN NOT APLLY

INDEXING WITH [ ] TO AN EXPRESSION TYP OF VOID..
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 LinqQuery (bool active)
{
if (active)
queryAllCustomers = from Rx_Register in Mo_4D_Details select

Rx_Register where Rx_Register.active = 'yes';

return queryAllCustomers;
}


protected void dynamicbutton_Click(object sender, 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;
}
}


Thanking You..
sha

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..
 
Share this answer
 
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

C#
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>


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 :-)
 
Share this answer
 
Comments
sharat naik 24-Jan-14 5:49am    
hello sir,

here i am using visual studio 2008, i got error in linqQuery ,its shows it was not exist in the current context.
CBadger 24-Jan-14 6:22am    
Raise a new question I will look at it and answer.

Post the code you are using and what the error is please :-)
sharat naik 25-Jan-14 0:56am    
Good morning dear sir,
Here i am getting error for belove code, sir can send me the working

example with design code. because i am a fresher sir..


design::

<asp:Panel ID="Panel1" runat="server">

<asp:ListView ID="ListView1" runat="server">

<asp:Label ID="Label1" runat="server"

Text="Label">


..................................................................................................
cs code...


using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using System.Text;


namespace Heavy_Water_management_System
{
public partial class Mo_4D_Details : System.Web.UI.Page
{
int i=0;
var queryAllCustomers;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (!IsPostBack)
AddControls();
Grd1();

}

}
string connection =

ConfigurationManager.ConnectionStrings["HWMSConnectionString"].ToStri

ng();

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 ++)//ERROR--OPERATOR '.'CAN

NOT BE APLLIED TO OPERAND TYP OF VOID
{
TextBox dynamictextbox = new TextBox();
dynamictextbox.Text = LinqQuery(true)[i].name);//CAN NOT APLLY

INDEXING WITH [ ] TO AN EXPRESSION TYP OF VOID..
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 LinqQuery (bool active)
{
if (active)
queryAllCustomers = from Rx_Register in Mo_4D_Details select

Rx_Register where Rx_Register.active = 'yes';

return queryAllCustomers;
}


protected void dynamicbutton_Click(object sender, 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;
}
}


Thanking You..
CBadger 27-Jan-14 0:56am    
sharat,

This question has been marked as answered. What I meant was ask a new question :-)
Copy and paste the comment you made under the tab "Ask A question". Same as you have done with the first question ;-)

Regards,

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900