Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

What could cause controls to show data in browser, but be empty when code attempts to read data?

$
0
0

The following is the beginning of a modal (truncated for brevity).

<asp:Panel ID="Panel_Instrument_Calibration" runat="server" Width="418px" Height="416px" BackColor="Gray" style="display:none;" ><asp:UpdatePanel ID="UpdatePanel_Instrument_Calibrate" runat="server" UpdateMode="Conditional"><ContentTemplate><table style="width :100%; height: 100%; padding: 0px;"><tr><td align="center"><asp:Panel ID="Panel_Instrument_Calibration_Internal" runat="server" Height="408px" Width="410px" BackColor="White" ><table style="width: 100%; height: 100%; padding: 0px; border-collapse:separate;"><tr id="MODAL_HEADER_BODY"><td align="center" valign="top" colspan="8"><table style="padding:2px; vertical-align:top; text-align:center; width: 100%;"><tr><td class="TableRow_Cell_Header" colspan="4"><center><asp:Label ID="Label_Instrument_Calibration_Label" runat="server" Text="Calibrate Instrument"></asp:Label></center></td></tr><tr><td align="left" colspan="4"><table style="width: 100%;"><tr><td align="right" ><asp:Label ID="Label_Instrument_Calibration_ISTM_NMBR_Label" runat="server" Text="Instrument:"></asp:Label></td><td align="left" colspan="3"><asp:Label ID="Label_Instrument_Calibration_ISTM_NMBR_Text" runat="server" Text="" CssClass="text_color_Gray"></asp:Label></td>
						...

Several of the controls are populated when the modal is opened and the rest require user input.

protected void Button_ItemTemplate_Action_Calibrate_OpenModal_Click(object sender, EventArgs e)
{
	Label_Instrument_Calibration_ISTM_NMBR_Text.Text = FormView1.DataKey.Value.ToString();
	UpdatePanel_Instrument_Calibrate.Update();
	ModalPopupExtender_Instrument_Calibration.Show();
}

Everything works fine at this point. All Labels and TextBoxes that should be populated are.

The issues occurs when I activate the AjaxFileUpload UploadComplete event, which is in the same modal, inside a TabPanel. When the upload button is clicked the following is triggered.

(truncated for brevity)

protected void AjaxFileUpload_Instrument_Calibration_Attachments_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
{
	string inst_nbr + Label_Instrument_Calibration_ISTM_NMBR_Text.Text;
}

......issue is that none of the controls show value when examined in the code behind.

Example:

When the modal is opened, Label_Instrument_Calibration_ISTM_NMBR_Text.Text is set to "123456" and the UpdatePanel update is triggered so the Label control will display the value that was just set.

One would think that after setting that Label to a value in the code behind, that the value would be present when the next server side event was triggered...........this is not the case, at least not when activated by the AjaxFileUpload control.

Other events, like Button clicks, etc do reveal that these controls do indeed contain the values that are visible in the browser. For some reason it seems that the AjaxFileUpload control makes the event ignorant of other controls values, even those outside of the modal.

I hope someone has an idea as to what is going on here and how to correct it.

Thanks.

UPDATE: From more searching I found that the AjaxFileUpload is in an iFrame, which has to be the cause...........but I have yet to discover a remedy.


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>