Vadivel Kumar wrote:
In my understanding you have a custom control or user control that
you've placed in a webform. Now, in the webform you have a dataset or
any data that you want to give it back to the control for processing
it.
The best way to do this is to use properties in the control and assign
the dataset from the webform when ever you want to process it.
this is my example
This is the straight forward way for this issue.
If you tried the same and got failed in any case, try post some code
with a breif explanation about how your're doing it.
Vadivel Kumar
http://www.vadivelk.net
Mukesh wrote: Hi all
I have to transfer a dataset and a string from a webform to a user
control on the page without using viewstate or session or cookies .
properties method is not working properly. if anybody thinks that is
fine so plz describe me and send me any article or example for that.
How can i do that
Plz send any article if any body have regarding this
plz Also cc to Mu****@efextra.com
Thx in advance
Mukesh
Mu****@efextra.com
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Microsoft.Practices.EnterpriseLibrary.Data;
namespace property
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.UserControl Test1;
public DataSet ds = new DataSet();
public string qw;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
string select ="select * from PropertyDisplay2";
Database db = DatabaseFactory.CreateDatabase();
DBCommandWrapper cmd = db.GetSqlStringCommandWrapper(select);
db.LoadDataSet(cmd,ds,"Results");
qw="jnbdfgkdfjsgh";
Controls.test mk = new Controls.test();
// mk.Mystr="mukesh agarwal";
// Test1.FindControl("DataGrid1").DataBind();
// property.Controls.test mk = new property.Controls.test();
// mk.i=125;
//
// Label lblbvl= (Label)Test1.FindControl("Label1");
// lblbvl.Text= "rjhgkjfdhgkfdjg";
// mk.MyNumber= 321321;
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void dataView1_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
{
}
}
}
namespace property.Controls
{
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
/// <summary>
/// Summary description for test.
/// </summary>
public class test : System.Web.UI.UserControl
{
protected System.Web.UI.WebControls.DataGrid DataGrid1;
protected System.Web.UI.WebControls.Label Label1;
string i;
public string Mystr
{
get
{
return i;
}
set
{
i = value;
}
}
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
Label1.Text += Mystr;
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}