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
M

Mariusz Wojcik

@Mariusz Wojcik
About
Posts
41
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to handle onselectindexchanged method in UserControl(.ascx page)
    M Mariusz Wojcik

    OKi, in addition to my above answer, there is a solution which uses interface. First, we implement an Interface: public interface IRadioButtonListEvent { void RadioButtonIndexChangedProc(object sender, System.EventArgs e); } As you can see, our interface implements just one method, which will be called whenever selected item index changes. Now, in the User Control, RadioButtonList1_SelectedIndexChanged should look like this: private void RadioButtonList1_SelectedIndexChanged(object sender, System.EventArgs e) { IRadioButtonListEvent iPage = (IRadioButtonListEvent) Page; iPage.RadioButtonIndexChangedProc(sender, e); } And finally, code for hosting web page. As i mentioned above, page must implement an IRadioButtonListEvent interface. public class WebForm1 : System.Web.UI.Page, IRadioButtonListEvent ... public void RadioButtonIndexChangedProc(object sender, System.EventArgs e) { RadioButtonList rbl = (RadioButtonList) sender; // do whatever you need... }

    -- Mariusz 'mAv' Wójcik master e-software engineer

    ASP.NET design tutorial

  • How to handle onselectindexchanged method in UserControl(.ascx page)
    M Mariusz Wojcik

    To do that you must first declare in your "hosting" aspx page a procedure which will handle an event: public void RadioButtonIndexChangedProc(object sender, System.EventArgs e) { RadioButtonList rbl = (RadioButtonList) sender; // do what you need with data. } Next in the user control, in the SelectedIndexChange event call that procedure: private void RadioButtonList1_SelectedIndexChanged(object sender, System.EventArgs e) { // get e reference to page object WebForm1 page = (WebForm1) Page; // call method handling Index changing page.RadioButtonIndexChangedProc(sender, e); } As you can see, you can access your hosting aspx page by using Page object, and by casting it to appropriate type (class of your hosting page, in my case WebForm1) you have access to all public class members. In case of reusing an usercontrol on diffrent web pages think about implementing one base class or implementing an Interface which will handle RadioButtonIndexChange by every class which uses your usercontrol.

    -- Mariusz 'mAv' Wójcik master e-software engineer

    ASP.NET design tutorial

  • cookies : how to write page_load to cookies
    M Mariusz Wojcik

    As I understand, you want to know how to create a new cookie. Below is a simple example how to do that. Depends on your needs, set appropriate properties of System.Web.HttpCookie object. Basically you simply add a new cookie object into Response.Cookies collection and that's all. Using Respose.Cookies class you can also remove or change any cookie your application creates. Dim cookie As System.Web.HttpCookie Dim cookieName As String Dim cookieValue As String cookie = New System.Web.HttpCookie(cookieName, cookieValue) Response.Cookies.Add(cookie)

    -- Mariusz 'mAv' Wójcik master e-software engineer

    ASP.NET com help tutorial

  • Validation to accept only numbers!!!
    M Mariusz Wojcik

    Well, you should change the ValidationExpression to accept more than one character. Also, decide whether you will accept +/- sign before the number, decimal point etc. Than build proper regular expression and that's it. I strongly recommend to read a little about "creating regular expression" on the MSDN. And to make it works, and accept any number of digits modify ValidationExpression to "[0-9]*".

    -- Mariusz 'mAv' Wójcik master e-software engineer

    ASP.NET csharp asp-net regex question

  • How to validate dynamic controls
    M Mariusz Wojcik

    Why don't you create dynamic Validators along with your TextBoxes? Just create appropriate Validator controls for each TextBox control you creating, assign it's properties and voila.

    -- Mariusz 'mAv' Wójcik master e-software engineer

    ASP.NET csharp asp-net database sysadmin help

  • radiobutton forecolor
    M Mariusz Wojcik

    Hi, The above idea is right, but there's small bug - as you can see watching HTML source code, ASP.NET creates RadioButton control as SPAN tag which contains INPUT and LABEL controls. Knowing that we must change the className attribute for that SPAN control, which unfortunately doesn't have an ID. The solution to this is to get INPUT’s control parent tag and change its className. The JavaScript code should look like that: // call this function to change colors function changeRadiobuttonsColorClasses() { changeRadiobuttonColorClass("rbNo", "clBgColorRed"); changeRadiobuttonColorClass("rbYes", "clBgColorGreen"); } // This function change className for control. // Params: // controlName - name of the control // className - new class name to set function changeRadiobuttonColorClass(controlName, className) { // first - find the control var el = document.getElementById(controlName); // if result is NULL, there's no control on the page if (el == null) return; // Now, find control's parent tag (should be SPAN). var elParent = el.parentNode if (elParent != null) elParent.className = className; } To assign JavaScript to control’s action you can simply type: onclick=” changeRadiobuttonsColorClasses()” in the control’s tag. -- Mariusz 'mAv' Wójcik master e-software engineer

    ASP.NET javascript database

  • Programmatically adding cells to a datagrid
    M Mariusz Wojcik

    Well, header is for column not the cell. To set the columns header text use this code:

    DataGrid1.Columns[0].HeaderText

    -- Mariusz 'mAv' Wójcik master e-software engineer (BPC)

    ASP.NET question

  • can i return sqlDatareader from a webservice
    M Mariusz Wojcik

    I don't think the SqlDataReader class is a good one to pass as a return type. This class is used to read data from the DBase, and it's strongly connected with the Database connection. I'm not sure it'll work (you'll be able to read data from dbase) if you send the object as a result. Definetely it's not the right way. -- Mariusz 'mAv' Wójcik master e-software engineer (BPC)

    ASP.NET question

  • Placing multiple pics in a gif
    M Mariusz Wojcik

    Don't know what you mean "rotating images". It's possible to create animate GIF (there are no animate JPEGs), so maybe this will help you. You can create animated gif in some graphics program. -- Mariusz 'mAv' Wójcik master e-software engineer (BPC)

    ASP.NET question

  • Referencing user control in Place holder?
    M Mariusz Wojcik

    First, give the control some name:

    c = Me.LoadControl("/lpages/Login.ascx");
    c.ID = "login";
    ph.Controls.Add(CType(c, lpages.Login))

    and then you need to find control FindControl("login"), cast it to the lpages.Login type and access properties. -- Mariusz 'mAv' Wójcik master e-software engineer (BPC)

    ASP.NET question tutorial

  • DataGrid
    M Mariusz Wojcik

    And how do you do the row selecting? Are you call the postback event, analogous to this one which is created by the DataGrid (for Select button)? It should be somethink like this:

    javascript:__doPostBack('DataGrid1$_ctl3$_ctl0','')

    -- Mariusz 'mAv' Wójcik master e-software engineer (BPC)

    ASP.NET database help

  • Upload Progress
    M Mariusz Wojcik

    I've just uploaded small article to the CodeProject (it's in ASP.NET section, Unedited Reader Contributions subsection). Hope it'll be helful. -- Mariusz 'mAv' Wójcik master e-software engineer (BPC)

    ASP.NET tutorial csharp com

  • Download
    M Mariusz Wojcik

    I don't think so. Basically the client side script shouldn't be able to save any information on the user's disk (or even access it). So the best way is to create the download page :) -- Mariusz 'mAv' Wójcik master e-software engineer (BPC)

    ASP.NET javascript sysadmin help question

  • Fire Session_End in Global.asax
    M Mariusz Wojcik

    Closing the browser window isn't equal to close/end the session. If you do close the browser window, no information is send to server, and as HTTP is stateless and connectionless, server do not know if the client (browser window) exists or it's been closed. So the user's session object will be close after it timeout's. There's no easy way to inform the server when user closes browser. The best way is to create some logout / end button which'll destroy the session and do all cleanup things (otherwise it'll exists until timeout occurs). -- Mariusz 'mAv' Wójcik master e-software engineer (BPC)

    ASP.NET question announcement

  • Security impersonation
    M Mariusz Wojcik

    I don't know the exact answer to your question, but maybe you can find some useful information in the Microsoft Patterns & Practices. Here are some links to books about designig WebServices: Building Secure ASP.NET Applications: Authentication, Authorization, and Secure Communication Authentication in ASP.NET: .NET Security Guidance.
    Hope, you find something useful. -- Mariusz 'mAv' Wójcik master e-software engineer (BPC)

    ASP.NET security question

  • Datagrid in Tablecell
    M Mariusz Wojcik

    You have to add your control to the cell's Controls collection. If you're using HTML table (not the asp:Table) you have to:
    1. in the table cell set the ID and runat properties:

    2. in the code, add objects declaration (C#):

    protected protected System.Web.UI.HtmlControls.HtmlTableCell cell1;

    or if you're using ASP:Table object, just add objects declaration (C#):

    protected System.Web.UI.WebControls.TableCell aCell;

    And now, to add the DataGrid:

    DataGrid dg = new DataGrid();
    ...
    aCell.Controls.Add(dg);

    -- Mariusz 'mAv' Wójcik master e-software engineer (BPC)

    ASP.NET help tutorial learning

  • PDF upload
    M Mariusz Wojcik

    Indeed, there is a property to determine max file upload size in ASP.NET. To everyone who need to upload big files:

    <configuration>
    <system.web>
    <httpRuntime maxRequestLength="40000"
    useFullyQualifiedRedirectUrl="true"
    executionTimeout="45">
    </system.web>
    </configuration>

    More info you can find at http://msdn.microsoft.com/library/en-us/cpgenref/html/gngrfHttpRuntimeSection.asp. -- Mariusz 'mAv' Wójcik master e-software engineer (BPC)

    ASP.NET help html sysadmin

  • Access to the Title Element of an HTML Page
    M Mariusz Wojcik

    You can also put <%= GetTitle() %> in the TITLE tag, and in your code create the function which returns page's title as string (C#):

    public string GetTitle()
    {
    return "MyPage. Access tick: " + DateTime.Now.Ticks;
    }

    Insted function you can use the property. -- Mariusz 'mAv' Wójcik master e-software engineer (BPC)

    ASP.NET html help question

  • PDF upload
    M Mariusz Wojcik

    Well, you should check your code again. PDF files uploads like all other files, so there must be some problem with the code. Maybe your PDF file is much bigger than other files you've tried to upload? Put your all uploading code into TRY...CATCH block and check what kind of error is generated (is there is one). -- Mariusz 'mAv' Wójcik master e-software engineer (BPC)

    ASP.NET help html sysadmin

  • Any Lost Focus in ASP?
    M Mariusz Wojcik

    Not in ASP, but you can use JavaScript. HTML objects have method blur() and event onblur. Use it like this:

    <input type="text" id="edName" onblur="alert('OnBlur event');">

    If you wish to assign some attribute to an ASP.NET object (in the code), you can use this:

    TextBox1.Attributes.Add("onblur", "alert('TextBox1 OnBlur event');");

    -- Mariusz 'mAv' Wójcik master e-software engineer (BPC)

    ASP.NET question
  • Login

  • Don't have an account? Register

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