473,395 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Problem CheckBox

Hi
Have have problems with CheckBoxs
because when a click on the CheckBox, rb.Text.Trim() write to me
results as how many exist CheckBoxs, but I want only one result
But when I click next CheckBox, the rb.Text.Trim() should be add to
result

public void DetayGoster(object sender,EventArgs e)

{
//txtSiraNo.Text="1";
CheckBox rb = new CheckBox();
rb = (CheckBox) sender;
sRbText = rb.ClientID;

foreach (DataGridItem di in DataGrid1.Items)

{
// rb = (CheckBox) i.FindControl ("rbsira");
// rb.Checked = false;
//if (sRbText==rb.ClientID)
//{
// rb.Checked = true;
if (rb.Checked )
{
txtSiraNo.Text += rb.Text.Trim();
}
// if you want to get a property of the selected id
//}
}
}
</script>

<body>
<form runat="server">
<asp:DataGrid runat="server" id="DataGrid1"
BorderColor="black"
BorderWidth="2"
CellPadding="2"
AutoGenerateColumns="false"
style="font-family:arial;font-size:10pt"
runat="server">
<HeaderStyle BackColor="#000099" forecolor="#ECEBE8" />
<Columns>
<asp:TemplateColumn HeaderText="Login">
<ItemTemplate>
<asp:CheckBox id="rbsira"
allowselectall="True" SelectionMode="Multiple" AutoPostBack=true
OnCheckedChanged="DetayGoster"
runat="server" cssclass="StdText" Text='<%#
DataBinder.Eval(Container.DataItem, "FirstName") %>' />

</ItemTemplate>

</asp:TemplateColumn>
<asp:BoundColumn DataField="EmployeeId"
HeaderText="Tytul" SortExpression="title, EmployeeId" />
<asp:BoundColumn DataField="firstname"
HeaderText="Ilość zleceń" SortExpression="title,
EmployeeId" />
</Columns>

</asp:DataGrid>
<asp:label id=txtSiraNo forecolor= "#000000"
runat="Server"></asp:label>

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

Help me, please
Jul 21 '05 #1
1 1023
Adam,

Than why don't you do in the event

if ((TextBox) sender.Checked) ................

Cor
Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: mike | last post by:
Hi there: I've read an excellent "how to"-article by Microsoft (no. 306227) - partly cited cited at the end of this email). I have implemented the code related to the part "How to Add a...
3
by: Ankit Aneja | last post by:
I have a strange situation and I have no idea how to solve this. Its a Recruitment Search Page,in the Admin Page, for every button click event the Admin Person has to create a checkbox on the users...
30
by: dbuchanan | last post by:
ComboBox databindng Problem == How the ComboBox is setup and used: My comboBox is populated by a lookup table. The ValueMember is the lookup table's Id and the DisplayMember is the text from a...
9
by: morellik | last post by:
Dear all, I have a program that creates dinamically a web page. In the page I have the following function to check how many checkbox are checked. function tarInfo(info) { var i=0; var c=0;...
2
by: swethak | last post by:
Hi, i am getting the problem when i used the onclick event in option tag.It is working fine in mozilla .But it is not working IE. Here is my code <script>
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.