Search Results

Search found 13 results on 1 pages for 'craigmoliver'.

Page 1/1 | 1 

  • Greek characters, Regular Expressions, and C#

    - by craigmoliver
    I'm building a CMS for a scientific journal and that uses a lot of Greek characters. I need to validate a field to include a specific character set and Greek characters. Here's what I have now: [^a-zA-Z0-9-()/\s] How do I get this to include Greek characters in addition to alphanumeric, '(', ')', '-', and '_'? I'm using C#, by the way.

    Read the article

  • Why am I getting null object reference error when saving (OnItemUpdating event) the first edit item

    - by craigmoliver
    I'm getting the error "Object reference not set to an instance of an object." when trying to reference a HiddenField (lvEditProjectSteps_hdnStepStatusId for future reference) from the EditItem during the OnItemUpdating event after the Update event fires in a ListView. This only occurs on the FIRST item in the ListView. I checked the source and the HTML is being rendered properly. ANY insight is appreciated! Thanks in advance... Source error: var lvEditProjectSteps_hdnStepStatusId = (HiddenField) lvEditProjectSteps.EditItem.FindControl("lvEditProjectSteps_hdnStepStatusId"); Here's the aspx side of the ListView: <asp:ListView ID="lvEditProjectSteps" runat="server" OnItemDataBound="lvEditProjectSteps_OnItemDataBound" OnItemUpdating="lvEditProjectSteps_OnItemUpdating" DataSourceID="odsEditProjectStep" DataKeyNames="Id"> <LayoutTemplate> <table class="standard-box-style" style="width:800px"> <thead> <tr> <th>&nbsp;</th> <th>&nbsp;</th> <th>Created</th> <th>Updated</th> </tr> </thead> <tbody> <asp:PlaceHolder ID="itemPlaceHolder" runat="server" /> </tbody> </table> </LayoutTemplate> <ItemTemplate> <tr> <td style="width:50px"<%# (Container.DisplayIndex % 2 == 0)?"":" class=\"row-alternating\"" %>> <asp:ImageButton ID="lvEditProjectSteps_btnEdit" runat="server" ImageUrl="~/admin/images/icons/edit.gif" AlternateText="Edit" SkinID="interfaceButton" CommandName="Edit" /> <asp:HiddenField ID="lvEditProjectSteps_hdnId" runat="server" Value='<%# Bind("Id")%>' /> <asp:HiddenField ID="lvEditProjectSteps_hdnStepStatusId" runat="server" Value='<%# Bind("StepStatusId")%>' /> <asp:HiddenField ID="lvEditProjectSteps_hdnStepStatusStepId" runat="server" Value='<%# Bind("StepStatus_StepId")%>' /> </td> <td style="width:30px"<%# (Container.DisplayIndex % 2 == 0)?"":" class=\"row-alternating\"" %>><asp:Image ID="imgStatus" runat="server" /></td> <td style="width:75px"<%# (Container.DisplayIndex % 2 == 0)?"":" class=\"row-alternating\"" %>><asp:Literal ID="litTsCreated" runat="server" /></td> <td style="width:75px"<%# (Container.DisplayIndex % 2 == 0)?"":" class=\"row-alternating\"" %>><asp:Literal ID="litTsUpdated" runat="server" /></td> </tr> </ItemTemplate> <EditItemTemplate> <tr> <td style="width:50px"<%# (Container.DisplayIndex % 2 == 0)?"":" class=\"row-alternating\"" %>> <asp:ImageButton ID="lvEditProjectSteps_btnUpdate" runat="server" ImageUrl="~/admin/images/icons/save.png" AlternateText="Save" SkinID="interfaceButton" CommandName="Update" ValidationGroup="EditProjectStepsSave" /> <asp:ImageButton ID="lvEditProjectSteps_btnCancel" runat="server" ImageUrl="~/admin/images/icons/cancel.png" AlternateText="Cancel" SkinID="interfaceButton" CommandName="Cancel" /> <asp:HiddenField ID="lvEditProjectSteps_hdnId" runat="server" Value='<%# Bind("Id")%>' /> <asp:HiddenField ID="lvEditProjectSteps_hdnStepStatusId" runat="server" Value='<%# Bind("StepStatusId")%>' /> <asp:HiddenField ID="lvEditProjectSteps_hdnStepStatusStepId" runat="server" Value='<%# Bind("StepStatus_StepId")%>' /> </td> <td style="width:180px" colspan="3"<%# (Container.DisplayIndex % 2 == 0)?"":" class=\"row-alternating\"" %>> <div><strong>Status</strong></div> <div class="radiobuttonlist-status"> <asp:RadioButtonList ID="lvEditProjectSteps_rblStatus" runat="server" RepeatDirection="Horizontal" AutoPostBack="true" OnSelectedIndexChanged="lvEditProjectSteps_rblStatus_OnSelectedIndexChanged"> <asp:ListItem Value="1"><img src="/images/icon/project-status/1.png" alt="Error" /></asp:ListItem> <asp:ListItem Value="2"><img src="/images/icon/project-status/2.png" alt="In Progress" /></asp:ListItem> <asp:ListItem Value="3"><img src="/images/icon/project-status/3.png" alt="Complete" /></asp:ListItem> </asp:RadioButtonList> <asp:RequiredFieldValidator ID="valRequired_lvEditProjectSteps_rblStatus" runat="server" ControlToValidate="lvEditProjectSteps_rblStatus" SetFocusOnError="true" Display="Dynamic" ErrorMessage="<br />^ required ^" ValidationGroup="EditProjectStepsSave" /> </div> </td> </tr> </EditItemTemplate> </asp:ListView> And the code-behind: protected void lvEditProjectSteps_OnItemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { var info = (ProjectStepInfo)DataBinder.GetDataItem(e.Item); // View Item var litTsCreated = (Literal)e.Item.FindControl("litTsCreated"); var litTsUpdated = (Literal)e.Item.FindControl("litTsUpdated"); var imgStatus = (Image) e.Item.FindControl("imgStatus"); if (litTsCreated != null) litTsCreated.Text = String.Format("{0:d}", info.TsCreated); if (litTsUpdated != null) litTsUpdated.Text = String.Format("{0:d}", info.TsCreated); if (imgStatus != null) imgStatus.ImageUrl = String.Format("/images/icon/project-status/{0}.png", info.StepStatus_StatusId); // Edit Item var lvEditProjectSteps_rblStatus = (RadioButtonList) e.Item.FindControl("lvEditProjectSteps_rblStatus"); if (lvEditProjectSteps_rblStatus != null) lvEditProjectSteps_rblStatus.SelectedValue = info.StepStatus_StatusId.ToString(); } } protected void lvEditProjectSteps_OnItemUpdating(object sender, ListViewUpdateEventArgs e) { if (IsValid) { var oController = new Controller(); var lvEditProjectSteps_hdnStepStatusId = (HiddenField) lvEditProjectSteps.EditItem.FindControl("lvEditProjectSteps_hdnStepStatusId"); var lvEditProjectSteps_hdnStepStatusStepId = (HiddenField) lvEditProjectSteps.EditItem.FindControl("lvEditProjectSteps_hdnStepStatusStepId"); var lvEditProjectSteps_rblStatus = (RadioButtonList) lvEditProjectSteps.EditItem.FindControl("lvEditProjectSteps_rblStatus"); var infoStepStatus = oController.StepStatus_SelectOne_StepId_StatusId(Convert.ToInt32(lvEditProjectSteps_hdnStepStatusStepId.Value), Convert.ToInt32(lvEditProjectSteps_rblStatus.SelectedValue)); if (lvEditProjectSteps_hdnStepStatusId != null) { e.NewValues["ProjectId"] = Convert.ToInt32(lvEditProjectSteps_hdnProjectId.Value); e.NewValues["StepStatusId"] = infoStepStatus.Id; } else { Response.Write("cancel"); e.Cancel = true; } } else { Response.Write("cancel, not valid"); e.Cancel = true; } } protected void lvEditProjectSteps_rblStatus_OnSelectedIndexChanged(object sender, EventArgs e) { var oController = new Controller(); var rbl = (RadioButtonList)sender; var lvEditProjectSteps_txtText = (TextBox) rbl.NamingContainer.FindControl("lvEditProjectSteps_txtText"); var lvEditProjectSteps_txtComment = (TextBox)rbl.NamingContainer.FindControl("lvEditProjectSteps_txtComment"); var lvEditProjectSteps_hdnStepStatusStepId = (HiddenField) rbl.NamingContainer.FindControl("lvEditProjectSteps_hdnStepStatusStepId"); if (!String.IsNullOrEmpty(lvEditProjectSteps_hdnStepStatusStepId.Value) && lvEditProjectSteps_txtText != null && lvEditProjectSteps_txtComment != null) { var infoStep = oController.Step_SelectOne(Convert.ToInt32(lvEditProjectSteps_hdnStepStatusStepId.Value)); var infoStepStatus = oController.StepStatus_SelectOne_StepId_StatusId(Convert.ToInt32(lvEditProjectSteps_hdnStepStatusStepId.Value), Convert.ToInt32(rbl.SelectedValue)); lvEditProjectSteps_txtText.Text = infoStep.Name; lvEditProjectSteps_txtComment.Text = infoStepStatus.Text; } }

    Read the article

  • Google Checkout, OpenId, and downloadable products

    - by craigmoliver
    I going to use Google Checkout to process orders to purchase downloadable content. When the order process is completed via Google Checkout I'd like for the user to be able come back to my site, authenticate using their Google credentials (OpenID?) that they purchased the item with linked back end, and download the goods. The site is written using C# and ASP.NET MVC. Is this possible or how should I rethink this? Are there open-source libraries to get me started?

    Read the article

  • using the ASP.NET Caching API via method annotations in C#

    - by craigmoliver
    In C#, is it possible to decorate a method with an annotation to populate the cache object with the return value of the method? Currently I'm using the following class to cache data objects: public class SiteCache { // 7 days + 6 hours (offset to avoid repeats peak time) private const int KeepForHours = 174; public static void Set(string cacheKey, Object o) { if (o != null) HttpContext.Current.Cache.Insert(cacheKey, o, null, DateTime.Now.AddHours(KeepForHours), TimeSpan.Zero); } public static object Get(string cacheKey) { return HttpContext.Current.Cache[cacheKey]; } public static void Clear(string sKey) { HttpContext.Current.Cache.Remove(sKey); } public static void Clear() { foreach (DictionaryEntry item in HttpContext.Current.Cache) { Clear(item.Key.ToString()); } } } In methods I want to cache I do this: [DataObjectMethod(DataObjectMethodType.Select)] public static SiteSettingsInfo SiteSettings_SelectOne_Name(string Name) { var ck = string.Format("SiteSettings_SelectOne_Name-Name_{0}-", Name.ToLower()); var dt = (DataTable)SiteCache.Get(ck); if (dt == null) { dt = new DataTable(); dt.Load(ModelProvider.SiteSettings_SelectOne_Name(Name)); SiteCache.Set(ck, dt); } var info = new SiteSettingsInfo(); foreach (DataRowView dr in dt.DefaultView) info = SiteSettingsInfo_Load(dr); return info; } Is it possible to separate those concerns like so: (notice the new annotation) [CacheReturnValue] [DataObjectMethod(DataObjectMethodType.Select)] public static SiteSettingsInfo SiteSettings_SelectOne_Name(string Name) { var dt = new DataTable(); dt.Load(ModelProvider.SiteSettings_SelectOne_Name(Name)); var info = new SiteSettingsInfo(); foreach (DataRowView dr in dt.DefaultView) info = SiteSettingsInfo_Load(dr); return info; }

    Read the article

  • Unicode escape characters not being read by XmlReader

    - by craigmoliver
    I've got an XML document that I'm importing into an XmlReader that has some unicode formatting I need to preserve. I'm preserving the whitespace but it's dropping the encoded #x2028 which I assume should be expressed as a line break. Here's my code: var settings = new XmlReaderSettings { ProhibitDtd = false, XmlResolver = null, IgnoreWhitespace = false }; var reader = XmlReader.Create(new StreamReader(fu.PostedFile.InputStream), settings); var document = new XmlDocument {PreserveWhitespace = true}; document.Load(reader); return document;

    Read the article

  • bin-deploying DLLs banned in leiu of GAC on shared IIS 6 servers

    - by craigmoliver
    I need to solicit feedback about a recent security policy change at an organization I work with. They have recently banned the bin-deployment of DLLs to shared IIS 6 application servers. These servers host many isolated web application pools. The new rules require all DLLs to be installed in GAC. The is a problem for me because I bin-deploy several dlls including the ASP.NET MVC Framework, HTML Agility Pack, ELMAH, and my own shared class libraries. I do this because: Eliminates web application server dependencies to the Global Assembly Cache. Allows me (the developer) to have control of what goes on inside my application. Enables the application to deployed as a "package". Removes application deployment burden from the server administrators. Now, here are my questions. From a security perspective what are the advantages to using the GAC vs. bin-deployment? Is it possible to host multiple versions of the same DLL in the GAC? Has anyone run into similar restrictions?

    Read the article

  • Clear form button in HTML...do we really need this?

    - by craigmoliver
    I usually add the clear form button to HTML forms by default, but tonight I had what alcholics call a "moment of clarity". Why the hell do we add this? In all my years of using the internet I have never gotten to the end of the form and thought "crap!, I screwed up, I need to reset this!". Is this button actually necessary or a hold over from another time?

    Read the article

1