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
J

JamieRushton_

@JamieRushton_
About
Posts
6
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Conditional Editing in Grid View
    J JamieRushton_

    In the ItemCommand event find out which button was clicked by using the CommandArgument attr. This could then fire a switch to choose the correct method (SetupFormA, SetupFormB) for looping thru the GridView so you can find and changing the the form fields required. I haven't tired this myself but that's how I would go about it to start with.

    ASP.NET css

  • Set label's text clientside and use it to set button's text server side.
    J JamieRushton_

    Only other way I can think of is to use a hidden field.

    <!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() {
    var value = "bye";

            document.getElementById("<%=Button2.ClientID %>").disabled = false;
    
            document.getElementById("<%=Label1.ClientID %>").innerText = value;
            document.getElementById("<%=hdnValue.ClientID %>").value = value;
        }
    </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" />
        
        <br />
        
        <asp:Label runat="server" ID="Label1" Text="hello" />
    
        <asp:HiddenField ID="hdnValue" runat="server" />
    </div>
    </form>
    

    </body>
    </html>

    void Page_Init(object sender, EventArgs e)
    {
    Button2.Click += new EventHandler(Button2_Click);
    }

    protected void Page_Load(object sender, EventArgs e)
    {
    }

    void Button2_Click(object sender, EventArgs e)
    {
    Button button = (Button)sender;
    button.Text = hdnValue.Value;
    }

    ASP.NET question javascript html sysadmin tools

  • Set label's text clientside and use it to set button's text server side.
    J JamieRushton_

    Oops sorry. Can you not simply use the code-behind to solve this issue? Because your clicking on a server control the page is reloaded back to its orginal state. If you want to change the text of the button after changing the label control using JavaScript then you will need to change the second button using JavaScript also.

    ASP.NET question javascript html sysadmin tools

  • Set label's text clientside and use it to set button's text server side.
    J JamieRushton_

    Markup - HTML

    <!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()
    {
    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" /><br />
        
        <asp:Label runat="server" ID="Label1" Text="hello" />
    </div>
    </form>
    

    </body>
    </html>

    Code-behind

    void Page_Init(object sender, EventArgs e)
    {
    Button2.Click += new EventHandler(Button2_Click);
    }

    protected void Page_Load(object sender, EventArgs e)
    {

    }

    void Button2_Click(object sender, EventArgs e)
    {
    Button button = (Button)sender;
    button.Text = "Something new";
    }

    ASP.NET question javascript html sysadmin tools

  • Front end & Back end
    J JamieRushton_

    http://en.wikipedia.org/wiki/Multitier_architecture#Web_development_usage[^]

    ASP.NET csharp question asp-net database

  • Adding textbox column to gridview programmatically (vb.net)
    J JamieRushton_

    Use the GridViews DataBound event. C#

    protected void Page_Init(object sender, EventArgs e)
    {
    GridView1.DataBound += new EventHandler(GridView1_DataBound);
    }

    void GridView1_DataBound(object sender, EventArgs e)
    {
    GridView gridview = (GridView)sender;

    try
    {
        foreach (GridViewRow row in gridview.Rows)
        {
            TextBox textbox = new TextBox();
            textbox.Text = "Something";
    
            TableCell tableCell = new TableCell();
            tableCell.Controls.Add(textbox);
    
            row.Cells.Add(tableCell);
        }
    }
    catch (Exception ex)
    {
    
    }
    

    }

    VB.NET

    Private Sub GridView1_DataBound(sender As Object, e As EventArgs)
    Dim gridview As GridView = CType(sender, GridView)
    Try
    For Each row As GridViewRow In gridview.Rows
    Dim textbox As New TextBox()
    textbox.Text = "Something"

        Dim tableCell As New TableCell()
        tableCell.Controls.Add(textbox)
    
        row.Cells.Add(tableCell)
    Next
    Catch ex As Exception
    End Try
    

    End Sub

    Web Development csharp
  • Login

  • Don't have an account? Register

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