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

ASP.NET

 
GeneralRe: Simple connection - What is wrong With This code? Pin
Parwej Ahamad21-Aug-07 22:08
professionalParwej Ahamad21-Aug-07 22:08 
GeneralRe: Simple connection - What is wrong With This code? Pin
greekius21-Aug-07 22:16
greekius21-Aug-07 22:16 
QuestionEnable-Disable web.config section. Pin
-- Abhi --21-Aug-07 21:19
-- Abhi --21-Aug-07 21:19 
AnswerRe: Enable-Disable web.config section. Pin
SimulationofSai21-Aug-07 22:35
SimulationofSai21-Aug-07 22:35 
GeneralRe: Enable-Disable web.config section. Pin
-- Abhi --21-Aug-07 23:08
-- Abhi --21-Aug-07 23:08 
QuestionOut parameter from Stored procedure [modified] Pin
manowj21-Aug-07 20:53
manowj21-Aug-07 20:53 
AnswerRe: Out parameter from Stored procedure Pin
Michael Sync21-Aug-07 21:26
Michael Sync21-Aug-07 21:26 
QuestionHelp with CheckBoxList Pin
paulsgregg21-Aug-07 20:34
paulsgregg21-Aug-07 20:34 
I am trying to build a list of items with checkboxes so that the users can remove several items from the list simultaneously. I have the list with the checkboxes displaying correctly. When I select a few items and click the remove button, event does not seem to be able to recognize that the items were selected.

I placed a blank table and CheckBoxList control on my page. I build the table to display the list during the Page_Load event. The list with checkboxes seems to work ok. When the RemoveItems_Click event fires, it cyles through the CheckboxList but it doens't recognized the Selected attribute so that I can remove the items.


Here are the relevant code snippets. Thanks for any feedback!

<asp:table id="ViewTable" runat="server">
<asp:checkboxlist id="RemoveItemsCheckBoxList" runat="server"
="" visible="False">


protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GetItemLists(RemoveItemsCheckBoxList);
}
}


public static void GetItemLists(CheckBoxList checkBoxList)
{

// Connect and fetch data

while (sqlDataReader.Read())
{
// build the ViewTable

// now create the checkbox and add it to the table

CheckBox checkBox = new CheckBox();
checkBox.ID = "RemoveCheckbox" + sqlDataReader["Id"].ToString();
checkBoxList.Items.Add(checkBox.ID.ToString());

cell = new TableCell();
cell.Controls.Add(checkBox);
row.Cells.Add(cell);
}

// clean up

}


protected void RemoveItemsButton_Click(object sender, EventArgs e)
{
foreach (ListItem listItem in RemoveItemsCheckBoxList.Items)
{

if (listItem.Selected == true)
{
// Remove the Item
...
}
}
AnswerRe: Help with CheckBoxList Pin
Michael Sync21-Aug-07 20:58
Michael Sync21-Aug-07 20:58 
QuestionUser Roles Pin
Illegal Operation21-Aug-07 20:30
Illegal Operation21-Aug-07 20:30 
QuestionLife cycle of ASP.Net page Pin
Milind Panchal21-Aug-07 20:27
Milind Panchal21-Aug-07 20:27 
AnswerRe: Life cycle of ASP.Net page Pin
Michael Sync21-Aug-07 20:53
Michael Sync21-Aug-07 20:53 
AnswerRe: Life cycle of ASP.Net page Pin
DavidNohejl21-Aug-07 21:56
DavidNohejl21-Aug-07 21:56 
AnswerRe: Life cycle of ASP.Net page Pin
Nouman Bhatti21-Aug-07 23:31
Nouman Bhatti21-Aug-07 23:31 
Questionautomatic installation of mysql db in the local machine Pin
praveenkumar_mca21-Aug-07 20:21
praveenkumar_mca21-Aug-07 20:21 
AnswerRe: automatic installation of mysql db in the local machine Pin
N a v a n e e t h21-Aug-07 21:05
N a v a n e e t h21-Aug-07 21:05 
QuestionCannot Upload from code Pin
abdelhameed8121-Aug-07 20:19
abdelhameed8121-Aug-07 20:19 
AnswerRe: Cannot Upload from code Pin
Goalie3522-Aug-07 3:23
Goalie3522-Aug-07 3:23 
QuestionGridView validation by Javascript Pin
Milind Panchal21-Aug-07 20:12
Milind Panchal21-Aug-07 20:12 
AnswerRe: GridView validation by Javascript Pin
Michael Sync21-Aug-07 21:16
Michael Sync21-Aug-07 21:16 
GeneralRe: GridView validation by Javascript Pin
Michael Sync21-Aug-07 21:17
Michael Sync21-Aug-07 21:17 
QuestionTabContainer in AjaxControlToolkit Pin
Milind Panchal21-Aug-07 20:08
Milind Panchal21-Aug-07 20:08 
AnswerRe: TabContainer in AjaxControlToolkit Pin
Illegal Operation21-Aug-07 20:38
Illegal Operation21-Aug-07 20:38 
Questionpdf file Pin
yesu prakash21-Aug-07 20:04
yesu prakash21-Aug-07 20:04 
AnswerRe: pdf file Pin
Christian Graus21-Aug-07 20:08
protectorChristian Graus21-Aug-07 20:08 

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.