Click here to Skip to main content
15,892,517 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: dropdown list Pin
somasekhara77724-Jan-09 22:48
somasekhara77724-Jan-09 22:48 
AnswerRe: dropdown list Pin
sudhanvag25-Jan-09 2:32
sudhanvag25-Jan-09 2:32 
AnswerRe: dropdown list Pin
CooperWu25-Jan-09 2:38
CooperWu25-Jan-09 2:38 
QuestionReading javascript modified value from a readOnly TextBox [modified] Pin
SmartSpider24-Jan-09 9:56
SmartSpider24-Jan-09 9:56 
AnswerRe: Reading javascript modified value from a readOnly TextBox Pin
Not Active24-Jan-09 13:23
mentorNot Active24-Jan-09 13:23 
GeneralRe: Reading javascript modified value from a readOnly TextBox Pin
SmartSpider25-Jan-09 7:54
SmartSpider25-Jan-09 7:54 
GeneralRe: Reading javascript modified value from a readOnly TextBox Pin
Not Active25-Jan-09 8:08
mentorNot Active25-Jan-09 8:08 
QuestionHow to create an array of buttons then access attributes in event handler Pin
scjsb24-Jan-09 7:48
scjsb24-Jan-09 7:48 
I am trying to learn C# etc by making this code work, its a mix of examples I've found on the web. The problem is the event handler never triggers. I would also like to change the text of the button that was clicked in the event handler. In a nutshell, I want to create an array of buttons, then change attributes as the text or color of the button selected. Eventually I want to add an array of labels which correstpond to these buttons and change the text or color depending on which button is pushed. Any help is appreciated.


public partial class _Default : System.Web.UI.Page
{
static Button[] btn_arr = new Button[14];
static int btn_count;

protected void Page_Load(object sender, EventArgs e)
{
try
{
if (btn_arr[0] is Button)
{
foreach (Button button in btn_arr)
{
add_button(button);
}
}
else
{

for (int i = 0; i < 14; i++)
{
Button new_button = new Button();
new_button.ID = "btn" + Convert.ToString(i);
new_button.Text = "Button" + Convert.ToString(i);
new_button.Click += new EventHandler(btn_Click);
btn_arr[btn_count++] = new_button;
add_button(new_button);
}
}

}
catch (Exception ex)
{
lblStatus.Text += ex.Message.ToString();
}
}


protected void add_button(Button button)
{
try
{
panelLineA.Controls.Add(button);
}
catch (Exception ex)
{
lblStatus.Text += ex.Message.ToString();
}
}

// this is never triggered
void btn_Click(object sender, EventArgs e)
{
int btnIndex = Convert.ToInt32(((Button)sender).ID.Substring(3, 1));
lblStatus.Text = "Button " + btnIndex + " was pushed." + ((Button)sender).ID;

}

}
AnswerRe: How to create an array of buttons then access attributes in event handler Pin
sudhanvag25-Jan-09 7:41
sudhanvag25-Jan-09 7:41 
Questioncan't get to display image in gridview Pin
Meax24-Jan-09 5:58
Meax24-Jan-09 5:58 
AnswerRe: can't get to display image in gridview Pin
CooperWu25-Jan-09 2:28
CooperWu25-Jan-09 2:28 
QuestionHelp! ASP.NET cannot do simple arithmetic... Pin
Ben Jern24-Jan-09 5:02
Ben Jern24-Jan-09 5:02 
AnswerRe: Help! ASP.NET cannot do simple arithmetic... Pin
Ben Jern24-Jan-09 5:38
Ben Jern24-Jan-09 5:38 
AnswerRe: Help! ASP.NET cannot do simple arithmetic... Pin
Colin Angus Mackay24-Jan-09 7:25
Colin Angus Mackay24-Jan-09 7:25 
GeneralRe: Help! ASP.NET cannot do simple arithmetic... Pin
Ben Jern24-Jan-09 14:26
Ben Jern24-Jan-09 14:26 
QuestionRestricting session sharing between multiple tabs in a browser. Pin
Praveen_S24-Jan-09 2:53
Praveen_S24-Jan-09 2:53 
AnswerRe: Restricting session sharing between multiple tabs in a browser. Pin
CooperWu24-Jan-09 4:16
CooperWu24-Jan-09 4:16 
Questionhow to add feature of changing color of text giving wide range of color to user in softare template creator using asp .net Pin
teju gadekar24-Jan-09 1:35
teju gadekar24-Jan-09 1:35 
GeneralRe: how to add feature of changing color of text giving wide range of color to user in softare template creator using asp .net Pin
CooperWu24-Jan-09 4:19
CooperWu24-Jan-09 4:19 
QuestionAjax and Asp.net Pin
ahawari0924-Jan-09 1:34
ahawari0924-Jan-09 1:34 
AnswerRe: Ajax and Asp.net Pin
Colin Angus Mackay24-Jan-09 2:49
Colin Angus Mackay24-Jan-09 2:49 
QuestionViewing aspx pages Pin
Ha ha ha ha ha ha ha ha24-Jan-09 1:09
Ha ha ha ha ha ha ha ha24-Jan-09 1:09 
AnswerRe: Viewing aspx pages Pin
Colin Angus Mackay24-Jan-09 1:13
Colin Angus Mackay24-Jan-09 1:13 
GeneralRe: Viewing aspx pages Pin
Ha ha ha ha ha ha ha ha24-Jan-09 1:24
Ha ha ha ha ha ha ha ha24-Jan-09 1:24 
GeneralRe: Viewing aspx pages Pin
Colin Angus Mackay24-Jan-09 1:50
Colin Angus Mackay24-Jan-09 1:50 

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.