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
  1. Home
  2. Web Development
  3. ASP.NET
  4. How do I get a HTML button server side accessible in the code behind

How do I get a HTML button server side accessible in the code behind

Scheduled Pinned Locked Moved ASP.NET
questionhtmldesignsysadmin
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 377904
    wrote on last edited by
    #1

    Hi All, What it needs to be done to access HtmlInputButton I have created one button (html controls) but when I create its nomenclature in the code behind as protected System.Web.UI.HtmlControls.HtmlInputButton btnSave; after that in page_load iam using this button as btnSave.Attributes.Add("onclick", "ValidateControls()"); During the run, I am getting "Object reference not set to an instance of an object." Why is that so ?? where I am going wrong ? Iam not able to use that html button let me know Sreenath

    P 1 Reply Last reply
    0
    • U User 377904

      Hi All, What it needs to be done to access HtmlInputButton I have created one button (html controls) but when I create its nomenclature in the code behind as protected System.Web.UI.HtmlControls.HtmlInputButton btnSave; after that in page_load iam using this button as btnSave.Attributes.Add("onclick", "ValidateControls()"); During the run, I am getting "Object reference not set to an instance of an object." Why is that so ?? where I am going wrong ? Iam not able to use that html button let me know Sreenath

      P Offline
      P Offline
      Paul Watson
      wrote on last edited by
      #2

      You need to put in an id not a name. e.g. <input type="button" **id**="btnSave" runat=server value="Save" /> regards, Paul Watson Bluegrass South Africa Miszou wrote: I have read the entire internet. on how boring his day was. Crikey! ain't life grand?

      D 1 Reply Last reply
      0
      • P Paul Watson

        You need to put in an id not a name. e.g. <input type="button" **id**="btnSave" runat=server value="Save" /> regards, Paul Watson Bluegrass South Africa Miszou wrote: I have read the entire internet. on how boring his day was. Crikey! ain't life grand?

        D Offline
        D Offline
        DotNet_Newbie
        wrote on last edited by
        #3

        Thanks for your reply, Actually, an id is what I have. Here is a snippet of code of what I have <form id="Form1" method="post" runat="server"> **<asp:textbox id="txtNumber"** _onkeyup="return txtQuoteNumber_onkeyup()"_ style="Z-INDEX: 101; LEFT: 24px; POSITION: absolute; TOP: 32px" runat="server" AutoPostBack="True"> </asp:textbox> **<asp:textbox id="txtFrmClient"** style="Z-INDEX: 104; LEFT: 400px; POSITION: absolute; TOP: 40px" runat="server"></asp:textbox> **<asp:textbox id="txtFrmServer"** style="Z-INDEX: 105; LEFT: 400px; POSITION: absolute; TOP: 80px" runat="server"></asp:textbox> **<asp:button** id="btnGet" style="Z-INDEX: 102; LEFT: 240px; POSITION: absolute; TOP: 32px" runat="server" Text="Get Quote"></asp:button> **<asp:datagrid** id="dgQuotes" style="Z-INDEX: 103; LEFT: 24px; POSITION: absolute; TOP: 88px" runat="server"></asp:datagrid> </form> now I also have function txtQuoteNumber_onkeyup() { //I want to be able to update one control from the other, for example txtFrmClient.value = txtQuoteNumber.value } Bsically I want to be able to update when another control gets updated, ultimately what I want to be able to do, is from the onkeyup function I want to force the grid to update Thanks for your help

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

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