Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
H

Hardus Lombaard

@Hardus Lombaard
About
Posts
19
Topics
12
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Open a text file in Notepad
    H Hardus Lombaard

    Any idea how to do this in ASP.NET?

    C# tutorial question

  • SPContext.Current is null
    H Hardus Lombaard

    I am new to Sharepoint development and I searched the web for an answer, but couldn't find anything that helped me. I am trying to upload text to a document library, but I get an error stating that SPContext.Current is null. What am I forgetting?

    SPSite siteCollection = SPContext.Current.Site;
    SPWeb curSite = SPContext.Current.Web;
    SPDocumentLibrary library = (SPDocumentLibrary)curSite.Lists["Shared Documents"];
    string documentName = txtFileName.Text;
    string libraryRelativePath = library.RootFolder.ServerRelativeUrl;
    string libraryPath = siteCollection.MakeFullUrl(libraryRelativePath);
    string documentPath = libraryPath + "/" + documentName;

    Stream documentStream = new MemoryStream();
    StreamWriter writer = new StreamWriter(documentStream);
    writer.Write(txtDocumentBody.Text);
    writer.Flush();

    curSite.Files.Add(documentPath, documentStream, true);

    SharePoint sharepoint help question

  • How to convert a field in a LINQ query
    H Hardus Lombaard

    One of the fields in my LINQ query is called 'DiaryDate'. This is a DateTime field. I want to convert it to a string in the format "dd/MM/yyyy" before I bind it to the grid (ugrdCases). How can I do this?

    var query = from c in this.BL.Policy.Cases
    select new
    {
    c.Value.CaseNumber,
    c.Value.TypeDescription,
    c.Value.AreaOfLawDescription,
    c.Value.DiaryDate,
    c.Value.ReportedDate,
    c.Value.StatusDescription,
    c.Value.LegalAdvisor.FirstName,
    c.Value.LegalAdvisor.BranchDescription,
    };
    ugrdCases.DataSource = null;
    ugrdCases.DataBind();
    ugrdCases.DataSource = query;
    ugrdCases.DataBind();

    LINQ question csharp css database linq

  • Access masterpage control in contentpage codebehind
    H Hardus Lombaard

    I have a masterpage called CaseManagement.Master and a content page called AppointmentSchedule. On my master page I have a textbox called txtPolicyNumber. How do I access this textbox from the content page's codebehind? "this.txtPolicyNumber" and "this.Master.txtPolicyNumber" doesn't work.

    ASP.NET question

  • Set label's text clientside and use it to set button's text server side.
    H Hardus Lombaard

    Thank you very much! It works!

    ASP.NET question javascript html sysadmin tools

  • Set label's text clientside and use it to set button's text server side.
    H Hardus Lombaard

    No. I am working on an application that utilizes a scheduling control. This control has a client-side click event that I must use. When I click on the control it must set a property wich in turn must be used when a button on the page is clicked. My solution to this was to set a label's text property but that doesn't seem to work, as you have seen in my code. Maybe you can help me out. Thanks anyways.

    ASP.NET question javascript html sysadmin tools

  • Enable button and change label's text clientside
    H Hardus Lombaard

    Could you perhaps explain the purpose of these return statements?

    ASP.NET javascript html sysadmin tools question

  • Set label's text clientside and use it to set button's text server side.
    H Hardus Lombaard

    I need to use the label's new text value in the code behind for further processing. Using 'this.label1.text' doesn't work as it gives the original text value not the new one.

    ASP.NET question javascript html sysadmin tools

  • Set label's text clientside and use it to set button's text server side.
    H Hardus Lombaard

    When I click Button1, Button2 gets enabled and the label's text is set to "bye". This is done with a bit of javascript. When Button2 is clicked, it's text should be set to "bye" - the new text value of the label, but is set to "hello" instead - the original text value of the label. How can I fix this? Aspx:

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title>Test</title>
    <script type="text/javascript">
    function Hello() {
    document.getElementById('Button2').disabled = false;
    document.getElementById('Label1').innerText = "bye";
    }
    </script>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <input id="Button1" type="button" value="Button1" onclick="Hello()" />
    <br />
    <asp:Button ID="Button2" runat="server" Enabled="False" Text="Button2"
    onclick="Button2_Click" />
    <br />
    <asp:Label runat="server" ID="Label1" Text="hello"></asp:Label>
    </div>
    </form>
    </body>
    </html>

    Cs:

    protected void Button2\_Click(object sender, EventArgs e)
    {
        this.Button2.Text = this.Label1.Text;
    }
    
    ASP.NET question javascript html sysadmin tools

  • Enable button and change label's text clientside
    H Hardus Lombaard

    When I click button 1, button 2 must be enabled and the label's text must change from "hello" to "bye". This must be done clientside through Javascript. How must I change the following code to get this to work? When I click button 1 the label's text changes but immediately reverts back to it's original value.

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title>Test</title>
    <script type="text/javascript">
    function Hello() {
    document.getElementById('Button2').disabled = false;
    document.getElementById('Label1').innerText = "bye";
    }
    </script>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="Hello()"/>
    <br />
    <asp:Button ID="Button2" runat="server" Enabled="False" Text="Button" />
    <br />
    <asp:Label runat="server" ID="Label1" Text="hello"></asp:Label>
    </div>
    </form>
    </body>
    </html>

    ASP.NET javascript html sysadmin tools question

  • Basic Javascript error
    H Hardus Lombaard

    I am quite new to Javascript and this question probably would seem very basic, but I am really stuck. I have a button. When I click it, the Javascript should cause an alert to display "hello" to the screen. When I build the project I get the error: 'ASP.default_aspx' does not contain a definition for 'Hello' and no extension method 'Hello' accepting a first argument of type 'ASP.default_aspx' could be found (are you missing a using directive or an assembly reference?) Aspx:

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title>Test</title>
    <script type="text/javascript">
    function Hello() {
    alert("hello");
    }
    </script>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <asp:Button ID="Button1" runat="server" Text="Button" onClick="Hello()"/>
    </div>
    </form>
    </body>
    </html>

    ASP.NET help question csharp javascript html

  • Webmethod needs to return string to Javascript function for processing.
    H Hardus Lombaard

    Yes, thanks. I've managed to make it work.

    ASP.NET javascript question csharp html asp-net

  • Webmethod needs to return string to Javascript function for processing.
    H Hardus Lombaard

    My apologies. Here is the formatted code: Cs:

    [System.Web.Services.WebMethod]
    public static string SetAppointmentInfo(int key)
    {
    return "Hello";
    }

    Aspx:

    <html xmlns="http://www.w3.org/1999/xhtml">
    <body>
    <form id="form1" runat="server">
    <div>
    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
    </asp:ScriptManager>
    <div>
    <uc1:WebUserControl ID="WebUserControl1" runat="server" />
    </div>
    </div>
    </form>
    </body>
    </html>

    Js:

    function WebDayView1_Click(oDayView, oEvent, element) {
    alert(PageMethods.SetAppointmentInfo(15, OnSucceeded, OnFailed));
    }
    function OnSucceeded() {
    //alert("Succeeded");
    }
    function OnFailed() {
    alert("Failed");
    }

    Cs (user control):

    protected void Page_Load(object sender, EventArgs e)
    {
    this.WebScheduleSqlClientProvider1.Connect("Database=cmRMI;Server=processor;user id=hardus;password=hardus");
    this.WebDayView1.ClientEvents.Click = "WebDayView1_Click"; //register click event
    }

    Aspx (user control):

    <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
    <Scripts>
    <asp:ScriptReference path="~/scripts/JScript.js" />
    </Scripts>
    </asp:ScriptManagerProxy>
    <igsch:WebScheduleInfo ID="WebScheduleInfo1" runat="server"
    onactivityadded="WebScheduleInfo1_ActivityAdded"
    onactivitydeleted="WebScheduleInfo1_ActivityDeleted" onactivityupdated="WebScheduleInfo1_ActivityUpdated" >
    </igsch:WebScheduleInfo>
    <p>
    <ig_scheduledata:WebScheduleSqlClientProvider ID="WebScheduleSqlClientProvider1"
    runat="server" WebScheduleInfoID="WebScheduleInfo1" StyleSetName=""
    StyleSetPath="" StyleSheetDirectory="">
    </ig_scheduledata:WebScheduleSqlClientProvider>
    </p>
    <igsch:WebDayView ID="WebDayView1" runat="server"
    WebScheduleInfoID="WebScheduleInfo1" StyleSetName="" StyleSetPath=""
    StyleSheetDirectory=""
    StyleSheetFileName="C:/Users/Hardus/Documents/Visual Studio 2008/WebSites/toets/ig_res/ElectricBlue/ig_dayview.css">
    </igsch:WebDayView>
    <igmisc:WebPageStyler ID="WebPageStyler1" runat="server"
    StyleSetName="Default" />

    ASP.NET javascript question csharp html asp-net

  • Webmethod needs to return string to Javascript function for processing.
    H Hardus Lombaard

    I have a WebDayView control (proprietary Infragistics ASP.net control) in a user control. This control has a client-side click event. The click event executes a piece of Javascript which in turn calls a static webmethod in the codebehind. What I want is for this webmethod to return the string “Hello” to the Javascript function so that an alert can display it. The problem that I have is that the alert displays “undefined” instead of “Hello”. This is because the webmethod executes only after the Javascript has executed. How can I get my code to work properly so that the alert displays the returned string from the webmethod? Cs: [System.Web.Services.WebMethod] public static string SetAppointmentInfo(int key) { return "Hello"; } Aspx: <html xmlns="http://www.w3.org/1999/xhtml"> <body> <form id="form1" runat="server"> <div> <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true"> </asp:ScriptManager> <div> <uc1:WebUserControl ID="WebUserControl1" runat="server" /> </div> </div> </form> </body> </html> Js: function WebDayView1_Click(oDayView, oEvent, element) { alert(PageMethods.SetAppointmentInfo(15, OnSucceeded, OnFailed)); } function OnSucceeded() { //alert("Succeeded"); } function OnFailed() { alert("Failed"); } Cs (user control): protected void Page_Load(object sender, EventArgs e) { this.WebScheduleSqlClientProvider1.Connect("Database=cmRMI;Server=processor;user id=hardus;password=hardus"); this.WebDayView1.ClientEvents.Click = "WebDayView1_Click"; //register click event } Aspx (user control): <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server"> <Scripts> <asp:ScriptReference path="~/scripts/JScript.js" /> </Scripts> </asp:ScriptManagerProxy> <igsch:WebScheduleInfo ID="WebScheduleInfo1" runat="server" onactivityadded="WebScheduleInfo1_ActivityAdded" onactivitydeleted="WebScheduleInfo1_ActivityDeleted" onactivityupdated="WebScheduleInfo1_ActivityUpdated" > </igsch:WebScheduleInfo> <p> <ig_scheduledata:WebScheduleSqlClientProvider ID="WebScheduleSqlClientProvider1" runat="server" WebScheduleInfoID="WebScheduleInfo1" StyleSetName="" StyleSetPath="" StyleSheetDirectory=""> </ig_scheduledata:WebScheduleSqlClientProvider> </p> <igsch:WebDayView ID="W

    ASP.NET javascript question csharp html asp-net

  • Click event of WebDayView in user control doesn't work
    H Hardus Lombaard

    I have a webdayview control (proprietary Infragistics ASP.net control) on my page. On the aspx source I’ve inserted some javascript (webdayview_click) that calls a webmethod in the codebehind. This seems to work fine, but when I insert this webdayview control into a user control and move the corresponding javascript into the aspx of the user control, it doesn’t work. I can’t even insert a breakpoint into the javascript function to debug it. Is there a way to make it work? I want to enable the click event of the webdayview control so that when I click on it, the javascript function calls the webmethod. Here’s my code (remember it's in a user control): Aspx: <!-- function WebDayView1_Click(oDayView, oEvent, element) { PageMethods.SetAppointmentInfo(oDayView.getSelectedActivity().getDataKey()) } // -->

    Cs: public partial class WebUserControl : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { this.WebScheduleSqlClientProvider1.Connect("Database=cmRMI;Server=processor;user id=hardus;password=hardus"); } [System.Web.Services.WebMethod] public static void SetAppointmentInfo(int key) { //Add code here } }

    ASP.NET debugging csharp javascript asp-net database

  • Open a text file in Notepad
    H Hardus Lombaard

    I have a windows app in which I want to open a text file in Notepad. When a button is clicked, a file dialog must open which lets the user select a file to be opened in notepad. I know how to create an OpenFileDialog, but I don't know how to open the selected file in Notepad. How does one do this?

    C# tutorial question

  • Preview report in Visual Studio 2003
    H Hardus Lombaard

    I've created a Crystal Reports report in a Visual Studio 2003 project and I'd like to preview it without running the project everytime. Is there a way to do this?

    Visual Studio csharp visual-studio question

  • Add a report to a Visual Studio Project
    H Hardus Lombaard

    How does one add an .rdl report created in SQL Server Business Intelligence Studio to a Visual Studio project and view it in a reportviewer? I've tried to rename the file from .rdl to .rdlc and then added it to my project. I've also recreated the dataset that the report uses in my project, but in the 'ReportViewer Tasks smart tags panel', in 'Choose Data Sources', there is no datasets to choose from to connect to my report. I don't know how to hook my report up to the dataset. Any help would be appreciated.

    Database csharp database sql-server visual-studio sysadmin

  • Inresponsive program during an Active Directory search.
    H Hardus Lombaard

    Below is some code that validates entries in a datagridview against entries in Active Directory and changes the color of the datagridview cells accordingly. A progressbar indicates how far the process is from finish. If the user then interacts with the form either by dragging one of the datagridview scrollbars or pressing a button, the program becomes unresponsive and the form doesn't refresh any longer until after the process is finished, thereby causing the progressbar to loose its functionality. How can I overcome this glitch? I would also like to implement a cancel button so that the user can cancel the validation process at any moment, but if a button is pressed I experience the problem mentioned above. Any help would be appreciated. Thanx. private void btnCheck_Click(object sender, EventArgs e) {                   using (DirectoryEntry de = new DirectoryEntry(adPath, adUsername, adPassword)) //))                                    {                         de.Username = Environment.UserName;                         de.AuthenticationType = AuthenticationTypes.Secure;                         //these are the attributes that will show                                       string[] attribs = new string[] { "displayName", "mail", "userAccountControl" };                         for (int x = 0; x < dgvManager.Rows.Count - 1; x++)                         {                               ValidateDetails(4, 5, 6, x, de, attribs); //Second in charge                               ValidateDetails(7, 8, 9, x, de, attribs); //Branch Manager

    C# help question windows-admin workspace
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups