objectdatasource

ObjectDataSource fails to parse string to DateTime

霸气de小男生 提交于 2019-12-02 00:45:16
问题 I have a textbox with value that stores ValidFrom form value: 31.01.2012 and cultures set to: <globalization culture="en-GB" uiCulture="en-GB"/> in web.config. And now, ObjectDataSource update method: public static void UpdateLac(int id, DateTime ValidFrom) { /// ... } fails as I get exception that string cannot be parsed. However date in format dd.mm.yyyy ( 31.01.2012 ) is valid en-GB format and can be parsed (as far as I know). I have tested it with following code: DateTimeFormatInfo dtfi =

nhibernate 2.0 Efficient Data Paging DataList Control and ObjectDataSource

…衆ロ難τιáo~ 提交于 2019-12-01 22:20:56
How would I do what Scott has done in one call using nHibernate 2 ObjectDataSource http://weblogs.asp.net/scottgu/archive/2006/01/07/434787.aspx below is my Data access method public IList GetListOfUser(int rows, int pageIndex) { IList userList = null; using (ITransaction tx = _session.BeginTransaction()) { try { userList = _session.CreateQuery("Select u from User u where u.DateSubmitted is not null") .SetFirstResult(rows * (pageIndex - 1) + 1) .SetMaxResults(rows) .List(); tx.Commit(); } catch (NHibernate.HibernateException ex) { tx.Rollback(); AppUtil.LogHelper.WriteLog(LogLevel.ERROR, ex

ObjectDataSource fails to parse string to DateTime

北慕城南 提交于 2019-12-01 20:57:56
I have a textbox with value that stores ValidFrom form value: 31.01.2012 and cultures set to: <globalization culture="en-GB" uiCulture="en-GB"/> in web.config. And now, ObjectDataSource update method: public static void UpdateLac(int id, DateTime ValidFrom) { /// ... } fails as I get exception that string cannot be parsed. However date in format dd.mm.yyyy ( 31.01.2012 ) is valid en-GB format and can be parsed (as far as I know). I have tested it with following code: DateTimeFormatInfo dtfi = CultureInfo.CreateSpecificCulture("en-GB").DateTimeFormat; var date = DateTime.Parse("31.01.2012",

If ObjectDataSource isn't the answer for a large application, what is?

旧时模样 提交于 2019-12-01 18:26:57
问题 Quoting the answer of Andrew Hare on the This Question. Object data sources are nice for small projects but they do not scale well as you are embedding data-layer information in the UI layer of your application. I would suggest that you only use them for very small applications and scratch-pad testing stuff. If you make a design decision to use them be prepared to struggle with scaling and maintenance issues in the future. Application Architecture = Maintainability + Scalability + ...... And

If ObjectDataSource isn't the answer for a large application, what is?

末鹿安然 提交于 2019-12-01 17:58:58
Quoting the answer of Andrew Hare on the This Question . Object data sources are nice for small projects but they do not scale well as you are embedding data-layer information in the UI layer of your application. I would suggest that you only use them for very small applications and scratch-pad testing stuff. If you make a design decision to use them be prepared to struggle with scaling and maintenance issues in the future. Application Architecture = Maintainability + Scalability + ...... And I think, every article that I've read to start learning application architecture used some classes to

Return Custom Object <List T> from Entity framework and assign to Object Data Source

拥有回忆 提交于 2019-12-01 16:05:52
I need some guidance with an issue, I am using Entity Framework 4.0, I have a DAL and BLL and am binding to ObjectDataSource on the page. I had to write a stored procedure using PIVOT and dynamic SQL to return the data from multiple entities the way I want. Now I am trying to figure out how can I get Entity Framework to return a custom object that I can bind to my ObjectDataSource on the page, I NEED to use a custom object or a dynamic object since the stored procedure can return any number of columns so I can't use a strongly typed class or entity and I need to be also able to bind this with

Return Custom Object <List T> from Entity framework and assign to Object Data Source

杀马特。学长 韩版系。学妹 提交于 2019-12-01 15:25:07
问题 I need some guidance with an issue, I am using Entity Framework 4.0, I have a DAL and BLL and am binding to ObjectDataSource on the page. I had to write a stored procedure using PIVOT and dynamic SQL to return the data from multiple entities the way I want. Now I am trying to figure out how can I get Entity Framework to return a custom object that I can bind to my ObjectDataSource on the page, I NEED to use a custom object or a dynamic object since the stored procedure can return any number

SelectMethod in objectDatasource getting called multiple times with multiple datapagerfield

眉间皱痕 提交于 2019-12-01 13:33:55
Ok, so here is the setup. I am building a page that has a listview, a datapager, and 3 datapagerfield (2 x NextPreviousPagerField, 1 x NumericPagerField), and a objectdatasource to tide all of this together. It was all working fine until I put a breakpoint into the SelectMethod specified in the objectdatsource control. It seems like that for each datapagerfield control, it is calling the selectmethod and selectcount method. Hence, whenever a user paged, it calls the database 6 times instead of 2 (I don't have caching turned on atm). If I remove one datapagerfield, it will remove 2 calls. Now

SelectMethod in objectDatasource getting called multiple times with multiple datapagerfield

二次信任 提交于 2019-12-01 11:12:13
问题 Ok, so here is the setup. I am building a page that has a listview, a datapager, and 3 datapagerfield (2 x NextPreviousPagerField, 1 x NumericPagerField), and a objectdatasource to tide all of this together. It was all working fine until I put a breakpoint into the SelectMethod specified in the objectdatsource control. It seems like that for each datapagerfield control, it is calling the selectmethod and selectcount method. Hence, whenever a user paged, it calls the database 6 times instead

Using generic classes with ObjectDataSource

有些话、适合烂在心里 提交于 2019-11-30 13:45:29
I have a generic Repository<T> class I want to use with an ObjectDataSource. Repository<T> lives in a separate project called DataAccess. According to this post from the MS newsgroups (relevant part copied below): Internally, the ObjectDataSource is calling Type.GetType(string) to get the type, so we need to follow the guideline documented in Type.GetType on how to get type using generics. You can refer to MSDN Library on Type.GetType: http://msdn2.microsoft.com/en-us/library/w3f99sx1.aspx From the document, you will learn that you need to use backtick (`) to denotes the type name which is