Search Results

Search found 10 results on 1 pages for 'gibbok'.

Page 1/1 | 1 

  • How to cast a STRING to a GUID

    - by GIbboK
    Hi, I need cast a String to a Guid. I am using this code but string myUserIdContent = ((Label)row.FindControl("uxUserIdDisplayer")).Text; Guid myGuidUserId = new Guid(myUserIdContent); // PROBLEM HERE MembershipUser mySelectedUser = Membership.GetUser(myGuidUserId); I receive this error Exception Details: System.FormatException: Unrecognized Guid format. ANy other ways to do it? thanks

    Read the article

  • Entity Framework 4 and SYSUTCDATETIME ()

    - by GIbboK
    Hi, I use EF4 and C#. I have a Table in my DataBase (MS SQL 2008) with a default value for a column SYSUTCDATETIME (). The Idea is to automatically add Date and Time as soon as a new record is Created. I create my Conceptual Model using EF4, and I have created an ASP.PAGE with a DetailsView Control in INSERT MODE. My problems: When I create a new Record. EF is not able to insert the actual Date and Time value but it inserts instead this value 0001-01-01 00:00:00.00. I suppose the EF is not able to use SYSUTCDATETIME () defined in my DataBase Any idea how to solve it? Thanks Here my SQL script CREATE TABLE dbo.CmsAdvertisers ( AdvertiserId int NOT NULL IDENTITY CONSTRAINT PK_CmsAdvertisers_AdvertiserId PRIMARY KEY, DateCreated dateTime2(2) NOT NULL CONSTRAINT DF_CmsAdvertisers_DateCreated DEFAULT sysutcdatetime (), ReferenceAdvertiser varchar(64) NOT NULL, NoteInternal nvarchar(256) NOT NULL CONSTRAINT DF_CmsAdvertisers_NoteInternal DEFAULT '' ); My Temporary solution: Please guys help me on this e.Values["DateCreated"] = DateTime.UtcNow; More info here: http://msdn.microsoft.com/en-us/library/bb387157.aspx How to use the default Entity Framework and default date values http://msdn.microsoft.com/en-us/library/dd296755.aspx

    Read the article

  • MVC Client Validation from Service Layer

    - by GibboK
    I'm following this article http://www.asp.net/mvc/tutorials/older-versions/models-(data)/validating-with-a-service-layer-cs to include a Service Layer with Business Logic in my MVC Web Application. I'm able to pass messages from the Service Layer to the View Model in a Html.ValidationSummary using ModelState Class. I perform basic validation logic on the View Model (using DataAnnotation attributes) and I have ClientValidation enabled by default which displaying the error message on every single field of my form. The Business logic error message which come from the Service Layer are being displayed on Html.ValidationSummary only after Posting the form to the Server. After Validation from the Service Layer I would like highlight one or more fields and have the message from the Service Layer showing on these fields instead that the Html.ValidationSummary. Any idea how to do it? Thanks

    Read the article

  • GridView take a Row

    - by GIbboK
    Hi I use asp.net 4 and c#. I have a GridView, I would like take a Row when in Edit Mode in my code and find a control. Here my code, but does not work, it takes only the first row for the GridView. Any ideas? protected void uxManageSlotsDisplayer_RowDataBound(object sender, GridViewRowEventArgs e) { switch (e.Row.RowType) { case DataControlRowType.DataRow: // Take Row in Edit Mode DOES NOT WORK PROEPRLY if (e.RowState == DataControlRowState.Edit) { Label myTest = (Label)e.Row.FindControl("uxTest"); } break; }

    Read the article

  • How to By Pass Request Validation

    - by GIbboK
    Hi, I have a GridView and I need update some data inserting HTML CODE; I would need this data been stored encoded and decoded on request. I cannot in any way disable globally "Request Validation" and not even at Page Level, so I would need a solution to disable "Request Validation" at Control Level. At the moment I am using a script which should Html.Encode every value being update, butt seems that "Request Validation" start its job before event RowUpdating, so I get the Error "Page A potentially dangerous Request.Form ... ". Any idea how to solve it? Thanks protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { foreach (DictionaryEntry entry in e.NewValues) { e.NewValues[entry.Key] = Server.HtmlEncode(entry.Value.ToString()); } PS I USE Wweb Controls not MVC

    Read the article

  • Bound a treeview control to user-defined complex type using EF 4

    - by GIbboK
    Hi, I use Asp.net, SQL 2008 and EF 4. I need display hierarchy data in a treeview control, Data is stored in a DB that use HierarchyId. Unfortunately, EF4 doesn't support HierarchyId. So in this case, I thought to have a stored procedure that deals with my hierarchy and return a result set back to EF that EF4 can turn into a collection of user-defined complex type that can then be bound directly to the treeview control. I imported a SPROC in EF 4 using Import Function and now I have a Complex DataType called: CategoryHierarchy_Result An image of my Model: Here some data from the Complex Type (in a GridView for example GridView1.DataSource = context.CategoryHierarchy(1);): My questions is: How to display my data from my Complex Type in a TreeView Control, showing a Tree structure that respect CategoryNodeString? I am a beginner an I never use TreeView before, any help or resource would be appreciated! Thanks!. Here some useful resource: http://www.robbagby.com/entity-framework/entity-framework-modeling-action-stored-procedures/

    Read the article

  • Details View and integration with TinyMCE <%@ Page validateRequest="false" %>

    - by GibboK
    I use TinyMCE in a DetailView in in EDIT MODE. I would like to know if there is a solution which can prevent Request Validation to trigger an error WITHOUT USING <%@ Page validateRequest="false" %> for my page. The only way I found out at the moment is to encode TextBox used by TinyMCE using option: "xml" tinyMCE.init({ encoding: "xml", In this way Request Validation does not trigger error but at the time to read the data in the TextBox the result it is Encoded. I also tried to Decode on PageLoad the content of the TextBox using this code myTextBox.Text = HttpUtility.HtmlDecode(myTextBox.Text) But the result is not as expected, so I can visualize it just Encoded text. Any Ideas? Thanks UPDATE I found a solution to my problem. I added in _DataBound event for the DetailsView this code TextBox myContentAuthor = (TextBox)uxAuthorListDetailsView.FindControl("uxContentAuthorInput"); myContentAuthor.Text = HttpUtility.HtmlDecode(myContentAuthor.Text); So on DataBound event, (should work even on post back) the content will be decodene for textbox tinymce. Here how should work: 01 - TinyMCE ESCAPE data inserted in textbox using function encoding: "xml", 02 - Data has been stored as ESCAPED 03 - To read the data and add its content to a TextBox where apply TinyMCE use in DATABOUND EVENT for DetailView and HttpUtility.HtmlDecode (so it will look decoded) 04 - You can modify content in the textbox in edit mode. On post back TinyMCE will encoded again using encoding: "xml" an so on Hope guys can help some one else. But please give me your comment on this solution thanks! Mybe you come up with more elegant solution! :-)

    Read the article

  • Linq - How to collect Anonymous Type as Result for a Function

    - by GibboK
    I use c# 4 asp.net and EF 4. I'm precompiling a query, the result should be a collection of Anonymous Type. At the moment I use this code. public static readonly Func<CmsConnectionStringEntityDataModel, string, dynamic> queryContentsList = CompiledQuery.Compile<CmsConnectionStringEntityDataModel, string, dynamic> ( (ctx, TypeContent) => ctx.CmsContents.Where(c => c.TypeContent == TypeContent & c.IsPublished == true & c.IsDeleted == false) .Select(cnt => new { cnt.Title, cnt.TitleUrl, cnt.ContentId, cnt.TypeContent, cnt.Summary } ) .OrderByDescending(c => c.ContentId)); I suspect the RETURN for the FUNCTION Dynamic does not work properly and I get this error Sequence contains more than one element enter code here. I suppose I need to return for my function a Collection of Anonymous Types... Do you have any idea how to do it? What I'm doing wrong? Please post a sample of code thanks! Update: public class ConcTypeContents { public string Title { get; set; } public string TitleUrl { get; set; } public int ContentId { get; set; } public string TypeContent { get; set; } public string Summary { get; set; } } public static readonly Func<CmsConnectionStringEntityDataModel, string, ConcTypeContents> queryContentsList = CompiledQuery.Compile<CmsConnectionStringEntityDataModel, string, ConcTypeContents>( (ctx, TypeContent) => ctx.CmsContents.Where(c => c.TypeContent == TypeContent & c.IsPublished == true & c.IsDeleted == false) .Select(cnt => new ConcTypeContents { cnt.Title, cnt.TitleUrl, cnt.ContentId, cnt.TypeContent, cnt.Summary }).OrderByDescending(c => c.ContentId));

    Read the article

  • T4 template for Validation in MVC

    - by GibboK
    I'm using ASp.Net MVC and EF 4.3.1. Using POCO t4 template I'm able to create the POCO classes for my model but not validation. At the moment I'm using Partial Classes with MetaData for adding the annotation (leaving intact the POCO auto generated). My question: Could you point me out a tutorial, or show me an example of code or a link to a T4 template the also include automatic VALIDATION for my POCO? THanks

    Read the article

  • Entity Framework 4 - Delete Object

    - by GibboK
    I have 3 Tables in my DataBase CmsMasterPages CmsMasterPagesAdvSlots (Pure Juction Table) CmsAdvSlots Here a Picture of my EDM: I need find out all objects CmsAdvSlot connected with a CmsMasterPage (it is working in my code posted belove), and DELETE the result (CmsAdvSlot) from the DataBase. My Problem is I am not able to DELETE this Objects when I found theme. Error: The object cannot be deleted because it was not found in the ObjectStateManager. int findMasterPageId = Convert.ToInt32(uxMasterPagesListSelector.SelectedValue); CmsMasterPage myMasterPage = context.CmsMasterPages.FirstOrDefault(x => x.MasterPageId == findMasterPageId); var resultAdvSlots = myMasterPage.CmsAdvSlots; // It is working until here foreach (var toDeleteAdv in resultAdvSlots) { context.DeleteObject(myMasterPage.CmsAdvSlots.Any()); // ERORR HERE!! context.SaveChanges(); } Any idea how to solve it? Thanks for your time! :-)

    Read the article

1