Click here to Skip to main content
16,016,744 members
Home / Discussions / C#
   

C#

 
AnswerRe: C# Grid Plugin Pin
Ron Beyer23-Jan-14 2:56
professionalRon Beyer23-Jan-14 2:56 
QuestionSet Location of ListView below DataGridView Active Row in C# Winform Pin
ahmed_one22-Jan-14 19:49
ahmed_one22-Jan-14 19:49 
AnswerRe: Set Location of ListView below DataGridView Active Row in C# Winform Pin
Mycroft Holmes22-Jan-14 21:33
professionalMycroft Holmes22-Jan-14 21:33 
GeneralRe: Set Location of ListView below DataGridView Active Row in C# Winform Pin
ahmed_one22-Jan-14 22:07
ahmed_one22-Jan-14 22:07 
GeneralRe: Set Location of ListView below DataGridView Active Row in C# Winform Pin
Mycroft Holmes22-Jan-14 22:23
professionalMycroft Holmes22-Jan-14 22:23 
GeneralRe: Set Location of ListView below DataGridView Active Row in C# Winform Pin
ahmed_one22-Jan-14 22:31
ahmed_one22-Jan-14 22:31 
QuestionAlgorithms which Max(x) Min(y) Pin
Swab.Jat22-Jan-14 17:18
Swab.Jat22-Jan-14 17:18 
QuestionDynamic created radio buttons wont execute event on click (c# .net ) Pin
salar136922-Jan-14 14:34
salar136922-Jan-14 14:34 
hi I have a button named Button1 in my form, and a text box named TexBox1.

I've written code that when I click the Button1, a Radio button gets created with it's own name:

c#:
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;

namespace WebApplication7
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ViewState["Counter"] = 0;
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {

            HtmlGenericControl div = new HtmlGenericControl("div");
            for (int i = 0; i < Convert.ToInt32(ViewState["Counter"]); i++)
            {
                RadioButton rb = new RadioButton();
                rb.GroupName = "GN1";
                rb.ID = i.ToString();
                rb.Text = "Button" + i.ToString();
                rb.Checked = false;
                rb.CheckedChanged += radioButton_CheckedChanged;
                div.Controls.Add(rb);
                Panel1.Controls.Add(div);

            }
            ViewState["Counter"] = Convert.ToInt32(ViewState["Counter"]) + 1;


        }
        private void radioButton_CheckedChanged(object sender, EventArgs e)
        {
            RadioButton btn = sender as RadioButton;
            TextBox1.Text = btn.Text;
        }
    }
}


.NET

ASP.NET
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication7.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

        <asp:Panel ID="Panel1" runat="server">
        </asp:Panel>
        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
        <br />
        <br />
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

        <br />
        <br />
        <br />

    </div>
    </form>
</body>
</html>


the problem is after several radio buttons being created, i want the program works as if each of them is checked, the TextBox1.Text gets the radio button's text string
but the function radioButton_CheckedChanged doesnt execute
AnswerRe: Dynamic created radio buttons wont execute event on click (c# .net ) Pin
Kornfeld Eliyahu Peter22-Jan-14 20:13
professionalKornfeld Eliyahu Peter22-Jan-14 20:13 
GeneralRe: Dynamic created radio buttons wont execute event on click (c# .net ) Pin
salar136923-Jan-14 8:30
salar136923-Jan-14 8:30 
GeneralRe: Dynamic created radio buttons wont execute event on click (c# .net ) Pin
Kornfeld Eliyahu Peter23-Jan-14 8:34
professionalKornfeld Eliyahu Peter23-Jan-14 8:34 
GeneralRe: Dynamic created radio buttons wont execute event on click (c# .net ) Pin
Gopi Kishan Mariyala22-Jan-14 22:24
Gopi Kishan Mariyala22-Jan-14 22:24 
GeneralRe: Dynamic created radio buttons wont execute event on click (c# .net ) Pin
salar136923-Jan-14 6:53
salar136923-Jan-14 6:53 
QuestionPainfully Slow Operation Pin
eddieangel22-Jan-14 11:07
eddieangel22-Jan-14 11:07 
AnswerRe: Painfully Slow Operation Pin
Matt T Heffron22-Jan-14 14:19
professionalMatt T Heffron22-Jan-14 14:19 
GeneralRe: Painfully Slow Operation Pin
eddieangel23-Jan-14 5:51
eddieangel23-Jan-14 5:51 
GeneralRe: Painfully Slow Operation Pin
Dave Kreskowiak23-Jan-14 7:48
mveDave Kreskowiak23-Jan-14 7:48 
GeneralRe: Painfully Slow Operation Pin
eddieangel23-Jan-14 7:59
eddieangel23-Jan-14 7:59 
QuestionRead XML values (attributes and elements) with C# Pin
SJR_122-Jan-14 5:14
SJR_122-Jan-14 5:14 
AnswerRe: Read XML values (attributes and elements) with C# Pin
Christian Wulff22-Jan-14 23:38
Christian Wulff22-Jan-14 23:38 
GeneralRe: Read XML values (attributes and elements) with C# Pin
SJR_123-Jan-14 4:59
SJR_123-Jan-14 4:59 
GeneralRe: Read XML values (attributes and elements) with C# Pin
Christian Wulff23-Jan-14 5:06
Christian Wulff23-Jan-14 5:06 
GeneralRe: Read XML values (attributes and elements) with C# Pin
SJR_123-Jan-14 5:33
SJR_123-Jan-14 5:33 
GeneralRe: Read XML values (attributes and elements) with C# Pin
Christian Wulff23-Jan-14 7:44
Christian Wulff23-Jan-14 7:44 
GeneralRe: Read XML values (attributes and elements) with C# Pin
SJR_123-Jan-14 9:03
SJR_123-Jan-14 9:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.