simonB2010
Programmer
Well new to .Net, new to WDM and new to the forums .. so hello !
.. and apologies if I may use the odd incorrect terminology, I shall do my best.
So, I have made a userControl from the standard GridView: 'myPageGridView'.
Unfortunately, there is one event that I am having to handle in the external web page itself, and I want to package it up into the class itself, so that the whole thing is nice and self-containg.
The code:
protected void SqlDataSource1_OnSelected(object sender, SqlDataSourceStatusEventArgs e)
{
myPageGridView1.MockItemCount = int.Parse(e.Command.Parameters["@setSize"].Value.ToString());
}
... this works fine in the end web page, just getting an output parameter from the dataSource and assigning it to a variable.
Now I do not want to have to copy'n'paste that code every time I use my grid.
So I want my class to get a handle on the instance's SQLDataSource and attach a handler to it.
Then the handler can grab the value within the class.
I have tried this, within the 'myPageGridView' class:
this.DataSourceObject.DataSourceChanged += new SqlDataSourceStatusEventHandler(myPageGridView_SQLSourceOnSelected);
..... but that doesn't seem to be the right handler, it's asking me to crerate the handling function with get/set only.
There was success when I did something similiar with another event, one belonging directly the Grid itself:
this.PageIndexChanging += new GridViewPageEventHandler(this.myPageGridView_PageIndexChanging);
... but I fear reaching out to the Grid's SQLDataSource is not just a s simple as referencing a level down !?!?
Ok ... so you can tell, this is day "1" of my .net life and I just hope that someone understands what I am looking at ....
Any help appreciated.
Thanks
Simon
.. and apologies if I may use the odd incorrect terminology, I shall do my best.
So, I have made a userControl from the standard GridView: 'myPageGridView'.
Unfortunately, there is one event that I am having to handle in the external web page itself, and I want to package it up into the class itself, so that the whole thing is nice and self-containg.
The code:
protected void SqlDataSource1_OnSelected(object sender, SqlDataSourceStatusEventArgs e)
{
myPageGridView1.MockItemCount = int.Parse(e.Command.Parameters["@setSize"].Value.ToString());
}
... this works fine in the end web page, just getting an output parameter from the dataSource and assigning it to a variable.
Now I do not want to have to copy'n'paste that code every time I use my grid.
So I want my class to get a handle on the instance's SQLDataSource and attach a handler to it.
Then the handler can grab the value within the class.
I have tried this, within the 'myPageGridView' class:
this.DataSourceObject.DataSourceChanged += new SqlDataSourceStatusEventHandler(myPageGridView_SQLSourceOnSelected);
..... but that doesn't seem to be the right handler, it's asking me to crerate the handling function with get/set only.
There was success when I did something similiar with another event, one belonging directly the Grid itself:
this.PageIndexChanging += new GridViewPageEventHandler(this.myPageGridView_PageIndexChanging);
... but I fear reaching out to the Grid's SQLDataSource is not just a s simple as referencing a level down !?!?
Ok ... so you can tell, this is day "1" of my .net life and I just hope that someone understands what I am looking at ....
Any help appreciated.
Thanks
Simon