As the login in based on the .NET2 Membership Provider:
Next step is to display the ‘races’ that the logged in user has competed in.
Use a RADGrid approach and LinqToSQL
**next is to do the linq query.
http://weblogs.asp.net/scottgu/archive/2007/07/16/linq-to-sql-part-5-binding-ui-using-the-asp-linqdatasource-control.aspx
need to do a where personID ==
just using the asp.net grid or even a repeater.. kiss.
Got it working, however am using
<asp:LinqDataSource ID="LinqDataSource1" runat="server"
ContextTypeName="Races.RacesDataClassesDataContext" TableName="races"
Where="personID == @personID">
<WhereParameters>
<asp:ControlParameter ControlID="TextBox1" DbType="Guid"
DefaultValue="63da93cb-1e76-4093-b74c-44503122d195" Name="personID"
PropertyName="Text" />
</WhereParameters>
</asp:LinqDataSource>
don’t need default value.
ideally want to set this directly to the
MembershipUser mUser = Membership.GetUser();
string UserID = mUser.ProviderUserKey.ToString();
Got this working:
protected void LinqDataSource1_Selecting(object sender, LinqDataSourceSelectEventArgs e)
{
MembershipUser currentUser = Membership.GetUser();
Guid currentUserId = (Guid)currentUser.ProviderUserKey;
e.WhereParameters["personID"] = currentUserId;
}
<asp:LinqDataSource ID="LinqDataSource1" runat="server"
ContextTypeName="Races.RacesDataClassesDataContext" TableName="races"
Where="personID == @personID">
<WhereParameters>
<asp:ControlParameter ControlID="TextBox1" DbType="Guid"
Name="personID" />
</WhereParameters>
</asp:LinqDataSource>
here is a trick for an error.. couldnt’ replicate.. discussed here: http://weblogs.asp.net/rajbk/archive/2008/01/31/linqdatasource-exceptions.aspx
add/edit/del
adding is a bit trickier:
http://www.codeproject.com/KB/aspnet/LinqDataSource3.aspx
http://weblogs.asp.net/zeeshanhirani/archive/2008/05/04/using-linqdatasource-for-inserts-updates-and-deletes.aspx
could just trying using the telerik Grid:
hmm – getting string errors except when I wire up the where clause to a textbox which is not good!
All good.. now trying to wire up the delete and edit which don’t seem to work with my select filter on LinqDataSouce.
Looked at older code for custom edit screens based on backend of SF.
Try delete and edit with no filter where clause.
All working once I sent the properties of the radGrid to do insert/update and delete.
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/linqdatasource/defaultcs.aspx
Adding
This took ages to find!
Not working properly.
http://dotnetnotes.i-do-it.com/CategoryView,category,ContentManagementSiteFinityControls.aspx – interesting notes on delete.
this would be nice:
// never seems to hit this.
public void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
if (e.Item is GridDataItem)
{
GridDataItem dataItem = e.Item as GridDataItem;
string DataItem = dataItem["nameOfRace"].Text;
//Add the message to the Button
LinkButton button = e.Item.FindControl("AutoGeneratedDeleteButton") as LinkButton;
button.Attributes["onclick"] = "return confirm('Are you sure you want to delete " +
DataItem + "?')";
}
}
look at telerik RAD Grid add – we want to extend this method to put in the currently logged in users guid too.
Testing RadGrid in a normal WebApp. Trick is to copy in the design dll into the bin folder of the project otherwise VS will complain
http://blogs.telerik.com/atanaskorchev/posts/09-03-06/meet_telerik_web_design_dll.aspx
Good demos and code for LinqToSQL crud.. aiming to get the Add new record working and passing through the categoryID.
http://weblogs.asp.net/scottgu/archive/2007/05/19/using-linq-to-sql-part-1.aspx – Scott Gu guide for LinqToSQL
Now getting this when putting together a test web app using the telerik control, and linq to sql. Strange!
some stuff in here for probable fixes, however doesn’t feel right: http://forums.asp.net/t/1264863.aspx
http://www.telerik.com/help/aspnet-ajax/grdlinqtosqlbindingcrudoperations.html – good manual for radgrid.
Going through a video:http://tv.telerik.com/radtips/episode/using-the-linqdatasource-in-your-radgrid
Had to register my RadScriptManager to get things working.
inline editing is good.
try and put the sample from the video live – what are the licensing restrictions on the radcontrols I’m running?
The Data context generated by the designer will live in the .Data namespace
The Tables generated will live in the .Entities namespace.
Adding a drop down for category in the grid… linked to another linqDataSouce not yet created
now adding a RadComboBox. AutoPostBack is true and Name is Name and ID is ProductCategoryID
configuring the products data source to be conditional of the drop down combo box.
The crowd goes wild 
tidy up files and remember what I am aiming to do.
make live
put database up there.. or 2 tables anyway.
Why Use RADGrid?
http://dotnetslackers.com/SQL/re-135853_HowTo_Telerik_RadGrid_Master_Detail_client_side_data_binding_using_LINQ_to_SQL_and_WebService.aspx
Go Live With RadGrid2
As things never go to plan when going live…
http://tv.telerik.com/radtips/episode/using-the-linqdatasource-in-your-radgrid
Remember to put in the Web.Design.dll into the bin directory (as we haven’t installed the tools into the GAC)
Register the scriptmanager with web.config.
Making the testgrid1 application live, and finding lots of issues with the too complex adventureworks2008 database
**todo – make a simple version of this database with the existing products.
Project is called TestRadGridTelerik2 – see work items for where I’m up to.
radgrid2.mateerit.co.nz