-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: jaykarthik
Message 3 in Discussion

This is the demo code i wrote to test ur  requirement....

its working fine..... just compare and see the mistake u done...

also its very much mandatory to add ur runtime control to the form...

just by adding it to the form alone will not serve the purpose.. 

u need to provide VerifyRenderingInServerForm method as i did..  if u dont have 
anything to code within that, u can leave blank as i did...

public partial class _Default : System.Web.UI.Page
{
    public Button b;
    public GridView gv;

    protected void Page_Load(object sender, EventArgs e)
    {       
            b = new Button();
            b.Click += new System.EventHandler(b_Click);
            b.Text = "Custom Button";
            b.ID = "btnCust";
            form1.Controls.Add(b);

            gv= new GridView();
            gv.ID = "CustGV";
            gv.RowDataBound+=new GridViewRowEventHandler(gv_RowDataBound);
            gv.RowCommand+=new GridViewCommandEventHandler(gv_RowCommand);
            gv.RowEditing+=new GridViewEditEventHandler(gv_RowEditing);       
            gv.AutoGenerateColumns = false;
            CreateCols(data());
            form1.Controls.Add(gv);
    }

protected void b_Click(object sender, EventArgs e)
    {
        gv.DataSource = data();
        gv.DataBind();       
    }


public override void VerifyRenderingInServerForm(Control control)
    {
       
    }

private DataSet data()
    {
        DataSet ds= new DataSet();
        DataTable dt= new DataTable();
        dt.Columns.Add("Name");
        dt.Columns.Add("City");
        dt.Columns.Add("Country");
       
        for( int i =0;i<10;i++)
        {
            DataRow dr = dt.NewRow();
            dr["Name"] = "NAME" + i.ToString();
            dr["City"] = "CITY" + i.ToString();
            dr["Country"] = "COUNTRY" + i.ToString();
            dt.Rows.Add(dr);
            dr = null;
        }
        ds.Tables.Add(dt);
        return ds;
    }


-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/BDOTNET/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member 
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you 
received this message by mistake, please click the "Remove" link below. On the 
pre-addressed e-mail message that opens, simply click "Send". Your e-mail 
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to