Click here to Skip to main content
15,912,204 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to maximize the main form at load time? Pin
Christian Graus23-Mar-07 6:35
protectorChristian Graus23-Mar-07 6:35 
AnswerRe: How to maximize the main form at load time? Pin
Saira Tanwir23-Mar-07 6:39
Saira Tanwir23-Mar-07 6:39 
GeneralRe: How to maximize the main form at load time? Pin
sinosoidal23-Mar-07 6:41
sinosoidal23-Mar-07 6:41 
QuestionHow to show a "Process with ..." entry in the File-Explorer context menu Pin
AlexZieg7123-Mar-07 6:14
AlexZieg7123-Mar-07 6:14 
AnswerRe: How to show a "Process with ..." entry in the File-Explorer context menu Pin
Stefan Troschuetz23-Mar-07 11:01
Stefan Troschuetz23-Mar-07 11:01 
GeneralRe: How to show a "Process with ..." entry in the File-Explorer context menu Pin
AlexZieg7123-Mar-07 12:47
AlexZieg7123-Mar-07 12:47 
QuestionActive Directory access Pin
Talal Sultan23-Mar-07 4:49
Talal Sultan23-Mar-07 4:49 
QuestionWeb, Dynamically Gridview creating Eventhandling Pin
peter.bellen@qsm-europe.com23-Mar-07 4:04
peter.bellen@qsm-europe.com23-Mar-07 4:04 
Greetings,

On a web page I have create several Gridviews dynamically as a result of a stored procedure.
The gridviews are building well and filled with data.
I also created the select and edit button on every gridview.
I also created several eventhandlers, delegates etc for these gridviews.

But what button's) I press on the grid, I never get into the subroutines I created for these purposes.
Do I also need to create something (a connection) for the dynamically created buttons and the events?

Thanks for every advice

Code:
public partial class Planning3 : System.Web.UI.Page
{
//Delegates ====================
//

//GridViewSelectEventHandler Delegate; Represents the method that handles the SelectedIndexChanging event of a GridView control.
public delegate void GridViewSelectEventHandler(Object sender, GridViewSelectEventArgs e);

//Gridview Rowcommand
public delegate void GridViewCommandEventHandler(Object sender, GridViewCommandEventArgs e);



//Delegates END ====================

private GridView CreateGridObject()
{
string stemp = "";
try
{
GridView GridViewObj = new GridView();
GridViewObj.ID = "Ellende";
GridViewObj.AutoGenerateColumns = false;
//GridView1.DataKeyNames = new string[] { "EmployeeID" };
GridViewObj.AllowPaging = true;
GridViewObj.AllowSorting = true;
GridViewObj.PageSize = 5;


//Select button
CommandField cfSelect = new CommandField();
cfSelect.ButtonType = ButtonType.Button;
cfSelect.ShowCancelButton = true;
cfSelect.ShowSelectButton = true;
GridViewObj.Columns.Add(cfSelect);

//Edit button
CommandField cfEdit = new CommandField();
cfEdit.ButtonType = ButtonType.Button;
cfEdit.ShowEditButton = true;
cfEdit.ShowCancelButton = true;
GridViewObj.Columns.Add(cfEdit);

//We need to add several eventhandlers
GridViewObj.RowCommand += new System.Web.UI.WebControls.GridViewCommandEventHandler(this.GridView1_RowCommand);
GridViewObj.SelectedIndexChanged += new EventHandler(this.GridView1_SelectedIndexChanged);
GridViewObj.SelectedIndexChanging += new System.Web.UI.WebControls.GridViewSelectEventHandler(this.GridView1_SelectedIndexChanging);

//Do I need to create a connection between the button and events?

BoundField bfRecID = new BoundField();
bfRecID.HeaderText = "RecID";
bfRecID.DataField = "RecID";
bfRecID.ReadOnly = true;
GridViewObj.Columns.Add(bfRecID);



BoundField bfUserID = new BoundField();
bfUserID.HeaderText = "UserID";
bfUserID.DataField = "UserID";
bfUserID.ReadOnly = true;
GridViewObj.Columns.Add(bfUserID);

BoundField bfGroupUserID = new BoundField();
bfGroupUserID.HeaderText = "GroupUserID";
bfGroupUserID.DataField = "GroupUserID";
bfGroupUserID.ReadOnly = true;
GridViewObj.Columns.Add(bfGroupUserID);

BoundField bfManagerID = new BoundField();
bfManagerID.HeaderText = "ManagerID";
bfManagerID.DataField = "ManagerID";
bfManagerID.ReadOnly = true;
GridViewObj.Columns.Add(bfManagerID);

BoundField bfManagerYN = new BoundField();
bfManagerYN.HeaderText = "ManagerYN";
bfManagerYN.DataField = "ManagerYN";
bfManagerYN.ReadOnly = true;
GridViewObj.Columns.Add(bfManagerYN);

BoundField bfName = new BoundField();
bfName.HeaderText = "Employee Name";
bfName.DataField = "Name";
bfName.ReadOnly = true;
GridViewObj.Columns.Add(bfName);

BoundField bfTask1 = new BoundField();
bfTask1.HeaderText = "Task1";
bfTask1.DataField = "Task1";
bfTask1.ReadOnly = false;
GridViewObj.Columns.Add(bfTask1);

BoundField bfTask2 = new BoundField();
bfTask2.HeaderText = "Task2";
bfTask2.DataField = "Task2";
bfTask2.ReadOnly = false;
GridViewObj.Columns.Add(bfTask2);

BoundField bfTask3 = new BoundField();
bfTask3.HeaderText = "Task3";
bfTask3.DataField = "Task3";
bfTask3.ReadOnly = false;
GridViewObj.Columns.Add(bfTask3);

BoundField bfTask4 = new BoundField();
bfTask4.HeaderText = "Task4";
bfTask4.DataField = "Task4";
bfTask4.ReadOnly = false;
GridViewObj.Columns.Add(bfTask4);

BoundField bfTask5 = new BoundField();
bfTask5.HeaderText = "Task5";
bfTask5.DataField = "Task5";
bfTask5.ReadOnly = false;
GridViewObj.Columns.Add(bfTask5);

BoundField bfTask6 = new BoundField();
bfTask6.HeaderText = "Task6";
bfTask6.DataField = "Task6";
bfTask6.ReadOnly = false;
GridViewObj.Columns.Add(bfTask6);

BoundField bfTask7 = new BoundField();
bfTask7.HeaderText = "Task7";
bfTask7.DataField = "Task7";
bfTask7.ReadOnly = false;
GridViewObj.Columns.Add(bfTask7);

BoundField bfTask8 = new BoundField();
bfTask8.HeaderText = "Task8";
bfTask8.DataField = "Task8";
bfTask8.ReadOnly = false;
GridViewObj.Columns.Add(bfTask8);

BoundField bfTask9 = new BoundField();
bfTask9.HeaderText = "Task9";
bfTask9.DataField = "Task9";
bfTask9.ReadOnly = false;
GridViewObj.Columns.Add(bfTask9);

BoundField bfTask10 = new BoundField();
bfTask10.HeaderText = "Task10";
bfTask10.DataField = "Task10";
bfTask10.ReadOnly = false;
GridViewObj.Columns.Add(bfTask10);

BoundField bfTask11 = new BoundField();
bfTask11.HeaderText = "Task11";
bfTask11.DataField = "Task11";
bfTask11.ReadOnly = false;
GridViewObj.Columns.Add(bfTask11);

BoundField bfTask12 = new BoundField();
bfTask12.HeaderText = "Task12";
bfTask12.DataField = "Task12";
bfTask12.ReadOnly = false;
GridViewObj.Columns.Add(bfTask12);

BoundField bfTask13 = new BoundField();
bfTask13.HeaderText = "Task13";
bfTask13.DataField = "Task13";
bfTask13.ReadOnly = false;
GridViewObj.Columns.Add(bfTask13);

BoundField bfTask14 = new BoundField();
bfTask14.HeaderText = "Task14";
bfTask14.DataField = "Task14";
bfTask14.ReadOnly = false;
GridViewObj.Columns.Add(bfTask14);

BoundField bfTask15 = new BoundField();
bfTask15.HeaderText = "Task15";
bfTask15.DataField = "Task15";
bfTask15.ReadOnly = false;
GridViewObj.Columns.Add(bfTask15);

//We need to add several eventhandlers
GridViewObj.RowCommand += new System.Web.UI.WebControls.GridViewCommandEventHandler(this.GridView1_RowCommand);
GridViewObj.SelectedIndexChanged += new EventHandler(this.GridView1_SelectedIndexChanged);
GridViewObj.SelectedIndexChanging += new System.Web.UI.WebControls.GridViewSelectEventHandler(this.GridView1_SelectedIndexChanging);



return GridViewObj;
}
catch (Exception err)
{
return null;

Loghandling.SchrijfNaarLogfile(false, "frmPlanning3.aspx", "AddGridviewToNewTable", 0, err.Message + " " + err.Source + " " + err.StackTrace.ToString() + " " + err.InnerException);
string strScherm = "frmPlanning3.aspx";
stemp = "frmError06.aspx?Scherm=" + strScherm;
Response.Redirect(stemp);
}
finally
{
}
}

Peter Bellen

bellenp@schneider.com
QuestionPrinting option Pin
netJP12L23-Mar-07 4:02
netJP12L23-Mar-07 4:02 
QuestionHelp with binding combo box and datarow column Pin
Matthew Cuba23-Mar-07 3:59
Matthew Cuba23-Mar-07 3:59 
AnswerRe: Help with binding combo box and datarow column Pin
joon vh.23-Mar-07 4:47
joon vh.23-Mar-07 4:47 
AnswerRe: Help with binding combo box and datarow column [modified] Pin
Zoltan Balazs23-Mar-07 5:49
Zoltan Balazs23-Mar-07 5:49 
AnswerRe: Help with binding combo box and datarow column Pin
Seishin#23-Mar-07 5:53
Seishin#23-Mar-07 5:53 
Questionhow to load web page Pin
Saira Tanwir23-Mar-07 3:28
Saira Tanwir23-Mar-07 3:28 
AnswerRe: how to load web page Pin
MoustafaS23-Mar-07 3:31
MoustafaS23-Mar-07 3:31 
GeneralRe: how to load web page Pin
joon vh.23-Mar-07 4:44
joon vh.23-Mar-07 4:44 
GeneralRe: how to load web page Pin
Saira Tanwir23-Mar-07 6:34
Saira Tanwir23-Mar-07 6:34 
QuestionListview control flckering in .NET 2.0 Pin
pliu_200023-Mar-07 3:27
pliu_200023-Mar-07 3:27 
AnswerRe: Listview control flckering in .NET 2.0 Pin
sharad subedi14-Aug-11 18:36
sharad subedi14-Aug-11 18:36 
QuestionGlobal mutex under NT4 [Answered] Pin
Dan Neely23-Mar-07 3:19
Dan Neely23-Mar-07 3:19 
QuestionPOS Application Pin
Waskira23-Mar-07 3:15
Waskira23-Mar-07 3:15 
AnswerRe: POS Application Pin
joon vh.23-Mar-07 3:21
joon vh.23-Mar-07 3:21 
GeneralRe: POS Application Pin
Waskira23-Mar-07 3:55
Waskira23-Mar-07 3:55 
GeneralRe: POS Application Pin
joon vh.23-Mar-07 4:05
joon vh.23-Mar-07 4:05 
GeneralRe: POS Application Pin
Zoltan Balazs23-Mar-07 6:11
Zoltan Balazs23-Mar-07 6:11 

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.