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
N

nguyenhh

@nguyenhh
About
Posts
6
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to use "User Controls" in Web Form? [modified]
    N nguyenhh

    Sherin Iranimose, I am learning .net, could you give me some example code to do this the correct way. my web form file:

    <%@ Import NameSpace="com.nangmoi" %>
    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Web" %>
    <%@ Page Language="C#" MasterPageFile="~/MasterPageHome.master" Title="www.nangmoi.com" %>

    <%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI.WebControls" TagPrefix="asp" %>
    <%@ Register src="Control/ControlFormBookSearch.ascx" tagname="ControlFormBookSearch" tagprefix="uc6" %>

    <script runat="server">
    private BookManager objManager = new BookManager();
    protected void Page_Load(object sender, EventArgs e)
    {
    if (!IsPostBack){

            GridView1.DataSource = objManager.getAuthorByAll();
            GridView1.DataBind();                         
        }
    }
    
    protected void btnSearch\_Click(object sender, EventArgs e)
    {
        //TextBox searchValue = (TextBox)Page.FindControl("searchValue");
        TextBox searchValue = (TextBox)ControlFormBookSearch1.FindControl("searchValue");
        
        if (searchValue != null)
            Response.Write(searchValue.Text);
        else Response.Write("Bad request");  
    }
    

    </script>
    <uc6:ControlFormBookSearch ID="ControlFormBookSearch1" runat="server" />  

    user control page

    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="ControlFormBookSearch.ascx.cs" Inherits="Control_ControlFormBookSearch" %>

    <table style="padding:0; border:solid 0px;">
    <tr valign="middle">
    <td style="vertical-align:top;border-bottom:solid 0px">
    Keyword: <asp:TextBox ID="searchValue" runat="server" value="test" /> 
    </td>
    </tr>
    </table>

    user control code behind:

    using System;
    using System.Collections;
    using System.Configuration;
    using System.Data;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;

    public partial class Control_ControlFormBookSearch : System.Web.UI.UserControl
    {
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    //How do i do this the correct way?? do i create properties like this?
    //then how do i use i
    
    ASP.NET question csharp winforms sysadmin tools

  • How to use "User Controls" in Web Form? [modified]
    N nguyenhh

    viivekk, Thank you for pointing that out, what I was missing is: instead of using:

    TextBox searchValue = (TextBox)Page.FindControl("searchValue");

    I should use:

    TextBox searchValue = (TextBox)ControlFormBookSearch1.FindControl("searchValue");

    as ControlFormBookSearch1 is the control id i used in my code. Thanks again.

    Hai

    ASP.NET question csharp winforms sysadmin tools

  • How to use "User Controls" in Web Form? [modified]
    N nguyenhh

    Hi Net Experts! This maybe a simple question for you all, but I have not been able to get it works, I created a web form page .aspx, and a user control file .ascx. Here is the code in my .ascx file

    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="ControlFormBookSearch.ascx.cs" Inherits="Control_ControlFormBookSearch" %>

    <table style="padding:0; border:solid 0px;">
    <tr valign="middle">
    <td style="vertical-align:top;border-bottom:solid 0px">
    Keyword: <asp:TextBox ID="searchValue" runat="server" /> 
    </td>
    </tr>
    </table>

    From my web form .aspx file, I wanted to access the control searchType this way:

    <%@ Register src="ControlBookDetail.ascx" tagname="ControlBookDetail" tagprefix="uc9" %>
    <script runat="server">
    protected void btnSearch_Click(object sender, EventArgs e)
    {
    TextBox searchValue = (TextBox)Page.FindControl("searchValue");//never find this control
    if (searchValue != null)
    Response.Write(searchValue.Text);
    else Response.Write("Bad request");
    }

    But I have not been able to get it to work. Could you please show me how to fix this? thank you for your helps! -Hai

    Hai

    modified on Friday, July 4, 2008 1:26 AM

    ASP.NET question csharp winforms sysadmin tools

  • Add Shipping Calculator to web site
    N nguyenhh

    Hi experts, Could someone please show me how to add a shipping calculator for UPS to my website? such as user will enter: weight, dimension, zipcode, and return the shipping cost for UPS? any help will be greatly appreciated. Hai Nguyen Hai

    ASP.NET help tutorial question

  • How to retrieve and display Image from database
    N nguyenhh

    I did try code in that link and several of them but no luck. the picture didn't show up on the page. it shows missing picture. I look its properties. it shows the .aspx file url. I suspect that the problem is from how I inserted images into SQL database. How I inserted images into database? I drag and drop the images directly into the database image fields, which has been desired for image type. could that be the problem ? (I use SQL MSDE2000 database with MS Access XP GUI) what happen? Hai

    ASP.NET database question sql-server com sysadmin

  • How to retrieve and display Image from database
    N nguyenhh

    Hi, this is probably ASP 001 lession, but for me it is new. Let say I have a table named: table1(ArticleTitle, ArticleContent, Image) How do I retrieve and display the image along with the ArticleTitle, ArticleContent? I can display the ArticleTitle and ArticleContent, but failed to display the image. Could someone please show me the neccessary controls and function that does this. This is link to my page: http://nangmoi.com/baiviet1.aspx?ID=14, I want a picture displayed next to this sample article. The picture is stored in the SQL Server database as type image. Thank you! haiao2000@yahoo.com Hai

    ASP.NET database question sql-server com sysadmin
  • Login

  • Don't have an account? Register

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