Click here to Skip to main content
15,900,461 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionListBoxes to display information when clicking the button Pin
Oga M10-Sep-07 22:42
Oga M10-Sep-07 22:42 
QuestionProblem with back button in IE [modified] Pin
abu sundus10-Sep-07 22:40
abu sundus10-Sep-07 22:40 
AnswerRe: Problem with back button in IE Pin
Sandeep Akhare10-Sep-07 23:49
Sandeep Akhare10-Sep-07 23:49 
GeneralRe: Problem with back button in IE Pin
abu sundus11-Sep-07 3:29
abu sundus11-Sep-07 3:29 
QuestionRecommend how to use ajax ...??? Pin
devboycpp10-Sep-07 22:39
devboycpp10-Sep-07 22:39 
QuestionAddin Table in panel at runtime Pin
Fahim A Salim10-Sep-07 22:37
Fahim A Salim10-Sep-07 22:37 
AnswerRe: Addin Table in panel at runtime Pin
Abolfazl Sheikhloo10-Sep-07 22:50
Abolfazl Sheikhloo10-Sep-07 22:50 
GeneralRe: Addin Table in panel at runtime Pin
Fahim A Salim10-Sep-07 23:17
Fahim A Salim10-Sep-07 23:17 
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page
{

//System.Collections.ArrayList ar = new System.Collections.ArrayList();
Table table = new Table();
Table outtable = new Table();
//Table table;
// Table outtable;


protected void Page_Load(object sender, EventArgs e)
{
//if ((Session["isaddclicked"] != null) && ((bool)Session["isaddclicked"]))
//{

// if (Session["controlsArray"] != null)
//{
// // ar = (System.Collections.ArrayList)Session["controlsArray"];
// table = (Table)Session["controlsArray"];
// }

//pnContralPanel.Controls.Add(table);
//pnoutputpanel.Controls.AddAt(0,outtable);
// }

//for (int i = 0; i < ar.Count; i=i+2)
//{
// //co (Control)ar[i];
// pnContralPanel.Controls.Add((Control)ar[i]);
// pnContralPanel.Controls.Add((Control)ar[i + 1]);

//}
//pnContralPanel.Controls.Add(table);
}

protected void btnAdd_Click(object sender, EventArgs e)
{
Control tdddddd=pnContralPanel.Controls[0];

if (Session["controlsArray"] != null)
{
table = (Table)Session["controlsArray"];
//pnContralPanel = (Panel)Session["controlsArray"];

}
//Session["isaddclicked"] = true;
String controltoadd = ddControlList.SelectedItem.Text;
Control obj = null;
Label lbl= new Label();
lbl.Text = txtCaption.Text;
if (controltoadd == "Text Box")
{
TextBox tb= new TextBox();
//tb.ID="txt"+txtCaption.Text;
tb.Text=txtValues.Text;
obj = tb;
}
else if (controltoadd == "Drop Down")
{
DropDownList dd = new DropDownList();
//dd.ID = "dd" + txtCaption.Text;
char[] ch={','};
String[] sepstring = txtValues.Text.Split(ch);
for (int i = 0; i < sepstring.Length; i++)
{
dd.Items.Add(sepstring[i]);
}
obj=dd;
}
else if (controltoadd == "Check Box")
{
CheckBox cb = new CheckBox();
//cb.ID = "cb" + txtCaption;
cb.Text = txtValues.Text;
obj = cb;
}
else
{
return;
}

TableRow tr=new TableRow();
tr.Cells.Add(new TableCell());
tr.Cells.Add(new TableCell());
tr.Cells[0].Controls.Add(lbl);
tr.Cells[1].Controls.Add(obj);

table.Rows.Add(tr);
Session["controlsArray"] = table;
table.ID = "abc";
pnContralPanel.Controls.Add(table);
//Session["controlsArray"] = pnContralPanel;
//pnContralPanel.Controls.AddAt(0, table);
ViewState["state"] = pnContralPanel;


}
protected void Button1_Click(object sender, EventArgs e)
{
// int idcdd=this.Controls.Count;
Session["isaddclicked"] = true;
// pnContralPanel = (Panel)ViewState["state"];
int c=pnContralPanel.Controls.Count;
//string s = pnContralPanel.Controls[0].GetType().ToString();
//cd = (Control)pnContralPanel.Controls[0];
Table t = (Table)pnContralPanel.Controls[0];



//Control tbcontrol = pnContralPanel.Controls[0];
//Table t = (Table)tbcontrol;
// table = (Table)pnContralPanel.Controls[0];
for (int i = 0; i < table.Rows.Count; i++)
{
TableRow toutr = new TableRow();
toutr.Cells.Add(new TableCell());
toutr.Cells.Add(new TableCell());
TableRow tr = t.Rows[i];
for (int j = 0; j < tr.Cells.Count; j++)
{
Control cn = tr.Cells[j].Controls[0];
Type tobj = cn.GetType();
switch (tobj.ToString())
{
case "System.Web.UI.WebControls.Label":
Label caption = (Label)cn;
Label ongoinglbl = new Label();
ongoinglbl.Text = caption.Text;
toutr.Cells[j].Controls.Add(ongoinglbl);
break;
case "System.Web.UI.WebControls.TextBox":
TextBox txt = (TextBox)cn;
Label value = new Label();
value.Text = txt.Text;
toutr.Cells[j].Controls.Add(value);
break;
case "System.Web.UI.WebControls.DropDownList":
DropDownList dd = (DropDownList)cn;
Label value1 = new Label();
value1.Text = dd.SelectedValue;
toutr.Cells[j].Controls.Add(value1);
break;
case "System.Web.UI.WebControls.CheckBox":
CheckBox cb = (CheckBox)cn;
Label value2 = new Label();
if (cb.Checked)
{
value2.Text = "yes";
}
else
{
value2.Text = "no";
}
toutr.Cells[j].Controls.Add(value2);
break;

}
}
outtable.Rows.Add(toutr);

}
pnoutputpanel.Controls.AddAt(0,outtable);
// Session["outTable"] = outtable;



}

}
QuestionDemonstration CD Pin
greekius10-Sep-07 22:36
greekius10-Sep-07 22:36 
AnswerRe: Demonstration CD Pin
Christian Graus10-Sep-07 23:54
protectorChristian Graus10-Sep-07 23:54 
QuestionDispose Pin
Priya S10-Sep-07 22:23
Priya S10-Sep-07 22:23 
AnswerRe: Dispose Pin
yogesh_kumar_agarwal10-Sep-07 22:28
yogesh_kumar_agarwal10-Sep-07 22:28 
GeneralRe: Dispose Pin
Priya S10-Sep-07 22:39
Priya S10-Sep-07 22:39 
AnswerRe: Dispose Pin
N a v a n e e t h10-Sep-07 22:44
N a v a n e e t h10-Sep-07 22:44 
QuestionHow to retrieve client's IP ?? Pin
devboycpp10-Sep-07 22:10
devboycpp10-Sep-07 22:10 
AnswerRe: How to retrieve client's IP ?? Pin
Abolfazl Sheikhloo10-Sep-07 22:32
Abolfazl Sheikhloo10-Sep-07 22:32 
QuestionGridview Delete Button Pin
yogesh_kumar_agarwal10-Sep-07 21:58
yogesh_kumar_agarwal10-Sep-07 21:58 
AnswerRe: Gridview Delete Button Pin
N a v a n e e t h10-Sep-07 22:47
N a v a n e e t h10-Sep-07 22:47 
GeneralRe: Gridview Delete Button Pin
yogesh_kumar_agarwal10-Sep-07 22:52
yogesh_kumar_agarwal10-Sep-07 22:52 
GeneralRe: Gridview Delete Button Pin
John-ph10-Sep-07 22:58
John-ph10-Sep-07 22:58 
GeneralRe: Gridview Delete Button Pin
yogesh_kumar_agarwal10-Sep-07 23:21
yogesh_kumar_agarwal10-Sep-07 23:21 
GeneralRe: Gridview Delete Button Pin
John-ph11-Sep-07 0:56
John-ph11-Sep-07 0:56 
AnswerRe: Gridview Delete Button Pin
varshavmane10-Sep-07 22:50
varshavmane10-Sep-07 22:50 
AnswerRe: Gridview Delete Button Pin
EbyZ_Ideas11-Sep-07 21:30
EbyZ_Ideas11-Sep-07 21:30 
QuestionGetting last ID after an insert statement Pin
soneliso10-Sep-07 21:49
soneliso10-Sep-07 21:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.