A
Adam
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">
<aspataGrid 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>
</aspataGrid>
<asp:label id=txtSiraNo forecolor= "#000000"
runat="Server"></asp:label>
</form>
</body>
</html>
Help me, please
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">
<aspataGrid 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>
</aspataGrid>
<asp:label id=txtSiraNo forecolor= "#000000"
runat="Server"></asp:label>
</form>
</body>
</html>
Help me, please