Click here to Skip to main content
15,913,941 members
Home / Discussions / C#
   

C#

 
GeneralRe: Sending Mail...and monitoring Inbox Pin
sindhutiwari18-Jan-08 20:22
sindhutiwari18-Jan-08 20:22 
GeneralRe: Sending Mail...and monitoring Inbox Pin
Abhijit Jana19-Jan-08 0:15
professionalAbhijit Jana19-Jan-08 0:15 
GeneralRe: Sending Mail...and monitoring Inbox Pin
N a v a n e e t h19-Jan-08 2:19
N a v a n e e t h19-Jan-08 2:19 
GeneralRe: Sending Mail...and monitoring Inbox Pin
DaveyM6919-Jan-08 5:48
professionalDaveyM6919-Jan-08 5:48 
Questionregarding SpVoice Pin
Member 475670918-Jan-08 17:39
Member 475670918-Jan-08 17:39 
GeneralRe: regarding SpVoice Pin
Paul Conrad18-Jan-08 18:00
professionalPaul Conrad18-Jan-08 18:00 
GeneralRe: regarding SpVoice Pin
Ravi Bhavnani19-Jan-08 5:47
professionalRavi Bhavnani19-Jan-08 5:47 
QuestionHow to update control in repeater Pin
allenpotter18-Jan-08 16:41
allenpotter18-Jan-08 16:41 
I have a nested repeater that I am trying to sum totals entered by a user, the code behind and repeater code is below. I get a null reference exception: an object reference not set to an instance of an object. the error is at: (((TextBox)parent.FindControl("TextBox2")).Text) = Convert.ToString(compPercent);

How can I get to this control to update, or add a label here?

public void AddComponent(object sender, EventArgs e)
{
int compPercent = 0;
foreach (RepeaterItem repItm in parent.Items)
{
foreach (Control childControl in repItm.Controls)
{
Repeater childRepeater = childControl as Repeater;
if (childRepeater != null)
{
foreach (RepeaterItem child in childRepeater.Items)
{
foreach (Control childControl2 in child.Controls)
{
CheckBox chk = childControl2 as CheckBox;
if (chk != null)
{
if (chk.Checked)
{
//get percent entered
compPercent = compPercent + Convert.ToInt32(((TextBox)child.FindControl("capabilitiesPercentEntered")).Text);
(((TextBox)parent.FindControl("TextBox2")).Text) = Convert.ToString(compPercent);
}
}
}
}
}
}
}
}


ASP Page:
<asp:repeater id="parent" runat="server">

<itemtemplate>
<tr>
<td width="50px"><b>Select</b></td>
<td width="350px"><b><%# DataBinder.Eval(Container.DataItem,"PSO") %></b></td>
<td><b>Enter %</b></td>
</tr>
<asp:repeater id="child" datasource='<%# ((DataRowView)Container.DataItem).Row.GetChildRows("myrelation") %>' runat="server">
<itemtemplate>
<tr>
<td><asp:CheckBox ID="CheckBox2" runat="server" />
<asp:HiddenField ID="hidden" runat="server" Value=<%# DataBinder.Eval(Container.DataItem, "[\"PSOComponent_id\"]" )%> /></td>
<td><%# DataBinder.Eval(Container.DataItem, "[\"PSOComponentName\"]")%> </td>
<td><asp:TextBox ID="capabilitiesPercentEntered" Width="40px" runat="server" OnTextChanged= "AddComponent" AutoPostBack="true" /></td>
</tr>
</itemtemplate>
</asp:repeater> <br />

<tr>
<td></td>
<td>Percent Total: </td>
<td><asp:TextBox ID="TextBox2" runat="server" Width="40px" Text="test text"></asp:TextBox></td>
</tr>
</itemtemplate>

<SeparatorTemplate>

<tr><td colspan=3><hr /></td></tr>
<SeparatorTemplate>

</asp:repeater>

</table>
AnswerRe: How to update control in repeater Pin
Paul Conrad19-Jan-08 11:45
professionalPaul Conrad19-Jan-08 11:45 
GeneralMS-DOS Command Pin
gmhanna18-Jan-08 14:47
gmhanna18-Jan-08 14:47 
GeneralRe: MS-DOS Command Pin
PIEBALDconsult18-Jan-08 14:55
mvePIEBALDconsult18-Jan-08 14:55 
GeneralRe: MS-DOS Command Pin
Paul Conrad18-Jan-08 18:01
professionalPaul Conrad18-Jan-08 18:01 
QuestionHow to call a base class method? Pin
Miszou18-Jan-08 13:58
Miszou18-Jan-08 13:58 
AnswerRe: How to call a base class method? Pin
Ed.Poore18-Jan-08 14:56
Ed.Poore18-Jan-08 14:56 
AnswerRe: How to call a base class method? [modified] Pin
PIEBALDconsult18-Jan-08 14:58
mvePIEBALDconsult18-Jan-08 14:58 
GeneralRe: How to call a base class method? Pin
Colin Angus Mackay18-Jan-08 15:05
Colin Angus Mackay18-Jan-08 15:05 
GeneralRe: How to call a base class method? Pin
PIEBALDconsult18-Jan-08 15:19
mvePIEBALDconsult18-Jan-08 15:19 
GeneralRe: How to call a base class method? Pin
Miszou18-Jan-08 16:38
Miszou18-Jan-08 16:38 
GeneralA problem with casting Pin
Clive D. Pottinger18-Jan-08 13:27
Clive D. Pottinger18-Jan-08 13:27 
GeneralRe: A problem with casting Pin
Ed.Poore18-Jan-08 13:57
Ed.Poore18-Jan-08 13:57 
GeneralRe: A problem with casting Pin
Luc Pattyn18-Jan-08 14:14
sitebuilderLuc Pattyn18-Jan-08 14:14 
GeneralRe: A problem with casting Pin
J$18-Jan-08 14:18
J$18-Jan-08 14:18 
GeneralRe: A problem with casting Pin
PIEBALDconsult18-Jan-08 15:33
mvePIEBALDconsult18-Jan-08 15:33 
GeneralRe: A problem with casting Pin
Clive D. Pottinger19-Jan-08 5:05
Clive D. Pottinger19-Jan-08 5:05 
GeneralProblem wyth colors (uint, hexa) Pin
alayle18-Jan-08 12:37
alayle18-Jan-08 12:37 

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.