Click here to Skip to main content
15,892,480 members
Home / Discussions / C#
   

C#

 
GeneralRe: how to Refresh the grid from Form2 Pin
Erdinc273-Jan-10 23:37
Erdinc273-Jan-10 23:37 
GeneralRe: how to Refresh the grid from Form2 Pin
sanforjackass3-Jan-10 23:47
sanforjackass3-Jan-10 23:47 
GeneralRe: how to Refresh the grid from Form2 Pin
OriginalGriff3-Jan-10 23:34
mveOriginalGriff3-Jan-10 23:34 
AnswerRe: how to Refresh the grid from Form2 Pin
Alex Manolescu3-Jan-10 23:52
Alex Manolescu3-Jan-10 23:52 
GeneralRe: how to Refresh the grid from Form2 Pin
Erdinc274-Jan-10 0:26
Erdinc274-Jan-10 0:26 
AnswerRe: how to Refresh the grid from Form2 Pin
Alex Manolescu4-Jan-10 9:46
Alex Manolescu4-Jan-10 9:46 
GeneralRe: how to Refresh the grid from Form2 Pin
Alex Manolescu5-Jan-10 23:58
Alex Manolescu5-Jan-10 23:58 
QuestionAn unhandled exception of type 'System.StackOverflowException' occurred in MyProject.web.DLL Pin
Qasim19843-Jan-10 22:09
professionalQasim19843-Jan-10 22:09 
Dear Expert I have usercontrol to create a new record/edit an existing record. The usercontrol have two constructors. one for "Create new record " and other for Load existing record for edit. When page have id in query string then load existing record for edit constructor execute otherwise create new rocord constructor executes.
The following is the code behind of usercontrol ("ContractControl")


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace DynamicForms.Portal.Controls
{
public partial class ContractControl : System.Web.UI.UserControl, IContract
{
protected bool _createMode;

public ContractControl()
{
_createMode = true;
this.Save += new EventHandler(ContractControl_Save);
this.Cancel += new EventHandler(ContractControl_Cancel);
}

public ContractControl(IContract contract)
{
_createMode = false;
this.Save += new EventHandler(ContractControl_Save);
this.Cancel += new EventHandler(ContractControl_Cancel);
ID = contract.ID;
Client_ID = contract.Client_ID;
Name = contract.Name;



}
protected void Page_Load(object sender, EventArgs e)
{

}

#region IContract Members
public Guid ID
{
get
{

return Guid.NewGuid();

}
set
{

ID = value;

}
}
public string Name
{
get
{

return NameTextBox.Text;

}
set
{
try
{

NameTextBox.Text = value;
}
catch
{
}

}
}
#region Public Events

public event EventHandler Save;
public event EventHandler Cancel;

#endregion
#region Default Public Event handelrs

protected void ContractControl_Save(object sender, EventArgs e)
{
//Do Nothing
}
protected void ContractControl_Cancel(object sender, EventArgs e)
{
//Do Nothing
}
#endregion
protected void SaveButton_Click(object sender, EventArgs e)
{
Save(this, e);
}
protected void CancelButton_Click(object sender, EventArgs e)
{
Cancel(this, e);
}
}

Following code execute on pageload of my webpage where I used above usercontrol

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{

if (Request.Params["id"] != null && Request.Params["id"].Length > 0)
{

Controllers.ContractController _controller=new Controllers.ContractController();
Controls.IContract _contract= _controller.Load(new Guid(Request["id"].ToString()));
ContractControl1 = new Controls.ContractControl(_contract);



}
else
{

ContractControl1 = new DynamicForms.Portal.Controls.ContractControl();



}
}

}
The new record is being created successfully. But editing throws following error
"An unhandled exception of type 'System.StackOverflowException' occurred in MyProject.web.DLL"
I am waiting your suggestions please.
AnswerRe: An unhandled exception of type 'System.StackOverflowException' occurred in MyProject.web.DLL Pin
SeMartens3-Jan-10 22:19
SeMartens3-Jan-10 22:19 
GeneralRe: An unhandled exception of type 'System.StackOverflowException' occurred in MyProject.web.DLL Pin
Qasim19843-Jan-10 22:22
professionalQasim19843-Jan-10 22:22 
GeneralRe: An unhandled exception of type 'System.StackOverflowException' occurred in MyProject.web.DLL Pin
SeMartens3-Jan-10 22:31
SeMartens3-Jan-10 22:31 
QuestionSQL and C# [modified] Pin
jojoba20103-Jan-10 22:04
jojoba20103-Jan-10 22:04 
AnswerRe: SQL and C# Pin
dan!sh 3-Jan-10 22:10
professional dan!sh 3-Jan-10 22:10 
GeneralRe: SQL and C# Pin
jojoba20103-Jan-10 22:13
jojoba20103-Jan-10 22:13 
GeneralRe: SQL and C# Pin
dan!sh 3-Jan-10 22:16
professional dan!sh 3-Jan-10 22:16 
QuestionRe: SQL and C# Pin
jojoba20103-Jan-10 22:19
jojoba20103-Jan-10 22:19 
AnswerRe: SQL and C# Pin
dan!sh 3-Jan-10 22:23
professional dan!sh 3-Jan-10 22:23 
QuestionRe: SQL and C# Pin
jojoba20103-Jan-10 22:25
jojoba20103-Jan-10 22:25 
AnswerRe: SQL and C# Pin
dan!sh 3-Jan-10 22:47
professional dan!sh 3-Jan-10 22:47 
QuestionRe: SQL and C# Pin
jojoba20103-Jan-10 22:57
jojoba20103-Jan-10 22:57 
AnswerRe: SQL and C# Pin
dan!sh 3-Jan-10 23:05
professional dan!sh 3-Jan-10 23:05 
QuestionRe: SQL and C# Pin
jojoba20103-Jan-10 23:09
jojoba20103-Jan-10 23:09 
AnswerRe: SQL and C# Pin
Not Active4-Jan-10 1:16
mentorNot Active4-Jan-10 1:16 
QuestionFile not to be copied Pin
jojoba20103-Jan-10 22:00
jojoba20103-Jan-10 22:00 
JokeRe: File not to be copied Pin
Dimitri Witkowski3-Jan-10 22:02
Dimitri Witkowski3-Jan-10 22:02 

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.