I am unable to figure out how to store a List of strings as a global variable, add to that list on button click for any unknown number of times, store that list in a session, and then properly access that session data in a separate page. I have gotten close, but have weird things occurring and my efforts to debug are doing even more unusual things.
Here is the first page script with Button1_Click() bound to OnClick of Button1:
<%# Page Language="C#" Debug="true" %>
<%# Import Namespace="System" %>
<%# Import Namespace="System.Collections.Generic" %>
<%# Import Namespace="System.Web" %>
<%# Import Namespace="System.Web.UI" %>
<%# Import Namespace="System.Web.UI.WebControls" %>
<%# Import Namespace="System.Drawing" %>
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta charset="utf-8"/>
<title></title>
<script type="text/javascript">
function validateNums(ele, evt)
{
var charCode = (evt.which) ? evt.which : event.keyCode;
if (charCode > 31 && (charCode < 48 || charCode > 57)) {
if (ele.id == 'TextBox1') {
var i = document.getElementById('TextBox1').value;
document.getElementById('TextBox1').value = i.slice(0, -1);
}
else
{
var b = document.getElementById('TextBox2').value;
document.getElementById('TextBox2').value = b.slice(0, -1);
}
}
}
</script>
<script runat="server">
private static int counter = 0;
List<string> reg = new List<string>();
protected void Page_Load(object sender, EventArgs e)
{
string[] states = { "AK","AL","AR","AS","AZ","CA","CO","CT","DC","DE","FL","GA","GU","HI","IA","ID",
"IL","IN","KS","KY","LA","MA","MD","ME","MH","MI","MN","MO","MS","MT","NC","ND","NE","NH","NJ","NM","NV","NY",
"OH","OK","OR","PA","PR","PW","RI","SC","SD","TN","TX","UT","VA","VI","VT","WA","WI","WV","WY" };
int b = 0;
foreach (string i in states)
{
this.DropDownList1.Items.Add(states[b]);
b++;
}
if (Session["counter"] != null)
{
Session.Clear();
}
else { counter = 0; }
}
protected void Page_Unload(object sender, EventArgs e)
{
Session["counter"] = counter;
}
protected void Button1_Click(object sender, EventArgs e)
{
if (TextBox1.Text.Length == 0) Alert_First();
if (TextBox2.Text.Length == 0) Alert_Second();
if (DropDownList1.SelectedValue == "") Alert_State();
if (TextBox4.Text.Length == 0) Alert_Password();
if (TextBox1.Text.Length != 0 && TextBox2.Text.Length != 0 && DropDownList1.SelectedValue != "")
{
if (Password_Validate()) Save_Registery();
else Alert_Password();
}
}
private bool Password_Validate()
{
foreach (char i in TextBox4.Text)
{
if (char.IsNumber(i))
return true;
}
return false;
}
private void Alert_First()
{
TextBox1.BackColor = Color.Red;
TextBox1.Text = "A value is required";
}
private void Alert_Second()
{
TextBox2.BackColor = Color.Red;
TextBox2.Text = "A value is required";
}
private void Alert_State()
{
DropDownList1.BackColor = Color.Red;
}
private void Alert_Password()
{
TextBox4.BackColor = Color.Red;
TextBox4.Text = "A value is required with at least one numeric value";
}
private void Save_Registery()
{
if (Session["regList"] != null)
{
reg.AddRange((List<string>)Session["regList"]);
}
reg.Add(TextBox1.Text);
reg.Add(TextBox2.Text);
reg.Add(DropDownList1.Text);
reg.Add(TextBox4.Text);
Session["regList"] = reg;
TextBox3.Text = counter.ToString();
counter++;
}
protected void Button2_Click(object sender, EventArgs e)
{
int count = 0;
foreach(string i in reg)
{
TextBox3.Text = TextBox3.Text + reg[0].ToString();
count++;
}
}
</script>
</head>
<body style="margin:auto; max-width:300px;">
<form id="form1" runat="server">
<div style="float:left; max-width:200px;" >
<asp:Label ID="Label1" runat="server" Text="First Name: "></asp:Label><br />
<asp:TextBox ID="TextBox1" runat="server" ></asp:TextBox>
<br />
<asp:Label ID="Label2" runat="server" Text="Last Name: "></asp:Label>
<br />
<asp:TextBox ID="TextBox2" runat="server" ></asp:TextBox>
<asp:Label ID="Label3" runat="server" Text="State"></asp:Label>
<br />
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem Value="" Text=""></asp:ListItem>
</asp:DropDownList>
<br />
<asp:Label ID="Label4" runat="server" Text="Password: "></asp:Label>
<br />
<asp:TextBox ID="TextBox4" runat="server" ></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
<asp:Label ID="Label5" runat="server" Text="All Fields are Required" Visible="false"></asp:Label>
<asp:TextBox ID="TextBox3" runat="server" TextMode="MultiLine"></asp:TextBox>
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Button" />
<asp:HiddenField ID="HiddenField1" runat="server" />
</div>
<a href="Results.aspx" style="">
<div>
<p>
Results
</p>
</div>
</a>
</form>
</body>
</html>
And here is the second page:
<%# Page Language="C#" Debug="true" %>
<%# Import Namespace="System" %>
<%# Import Namespace="System.Collections.Generic" %>
<%# Import Namespace="System.Web" %>
<%# Import Namespace="System.Data" %>
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
int counter = Convert.ToInt16(Session["counter"]);
Repeater1.DataSource = (List<string>)Session["regList"];
Repeater1.DataBind();
}
</script>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<%= Session["counter"] %>
</div>
<asp:Repeater ID="Repeater1" runat="server">
<HeaderTemplate>
<table>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<%# Container.DataItem %>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</form>
</body>
</html>
This outputs only the LAST set of data that I entered via the previous page. The count I added to help debug tells me that there is only 3 values in my session variable of "regList". My question is why is my data getting overwritten every time the Button1_Click() is fired?
In the pageload event of the first page, you are resetting the seesion list by reg,
Session["regList"] = reg;
which by that time the reg is an empty list, and it becomes an issue
Related
I have a Submit button and on submit button click I want to check if my dropdown's selected index has changed or not. If yes, it should call a function.
I don't know how to do it in asp.net C#, need help.
<asp:DropDownList ID="ddlIncidentStatus" runat="server"
Enabled="false"
Display="Dynamic"
AppendDataBoundItems="True"
AutoPostBack="true"
CssClass="form-control">
<asp:ListItem Value="0">- Select Incident Status -</asp:ListItem>
</asp:DropDownList>
protected void btnSave_Click(object sender, System.EventArgs e)
{
if ((SaveToMemory() > 0))
{
//here i want to check if ddlIncidentStatus has change the value or not
Response.Redirect(("IncidentReport_New.aspx?OHSIncidentID=" +
Encryption.EncryptParameter(_incident.OHSIncidentID.ToString())));
}
}
}
Example.aspx
<%# Page Title="Home Page" Language="C#" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="DropDownListExample._Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<p>Select a City of Your Choice</p>
<div>
<asp:DropDownList ID="DropDownList1" runat="server" >
<asp:ListItem Value="">Please Select</asp:ListItem>
<asp:ListItem>New Delhi </asp:ListItem>
<asp:ListItem>Greater Noida</asp:ListItem>
<asp:ListItem>NewYork</asp:ListItem>
<asp:ListItem>Paris</asp:ListItem>
<asp:ListItem>London</asp:ListItem>
</asp:DropDownList>
</div>
<br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Submit" />
<br />
<br />
<asp:Label ID="Label1" runat="server" EnableViewState="False"></asp:Label>
</form>
</body>
</html>
Example.aspx.cs
protected void Button1_Click(object sender, EventArgs e)
{
if (DropDownList1.SelectedValue == "")
{
Label1.Text = "Please Select a City";
}
else
Label1.Text = "Your Choice is: " + DropDownList1.SelectedValue;
}
This is user control page
<%# Control Language="C#" AutoEventWireup="true" CodeBehind="UserInfoBoxControl.ascx.cs"
Inherits="WebApplication3.UserInfoBoxControl" %>
<b>Information about <%# this.UserName %></b><br /><br />
<%# this.UserName %> is <%# this.UserAge %> years old and lives in <%# this.UserCountry %>
Controller CS file
public partial class UserInfoBoxControl : System.Web.UI.UserControl
{
private string userName;
private int userAge;
private string userCountry;
public string UserName
{
get { return userName; }
set { userName = value; }
}
public int UserAge
{
get { return userAge; }
set { userAge = value; }
}
public string UserCountry
{
get { return userCountry; }
set { userCountry = value; }
}
protected void Page_Load(object sender, EventArgs e)
{
}
}
webform on which i want to implement this.
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication3.WebForm1" %>
<%# Register TagPrefix="My" TagName="UserInfoBoxControl" src="~/UserInfoBoxControl.ascx" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<br /><br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
<br /><br />
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem>No one</asp:ListItem>
<asp:ListItem>World</asp:ListItem>
<asp:ListItem>Universe</asp:ListItem>
</asp:DropDownList>
<br /><br />
<My:UserInfoBoxControl runat="server" ID="MyUserInfoBoxControl" />
</div>
</form>
</body>
</html>
Getting error
Error rendering control: Myuserinfoboxcontrol
the server block is now well formed.
i am not getting how to rectify it
i want to implement user control on my webform but i am getting this error. Need help. thanks
i guess this:
<b>Information about <%# this.UserName %></b><br /><br />
<%# this.UserName %> is <%# this.UserAge %> years old and lives in <%#
this.UserCountry %>
should be:
<b>Information about <%= this.UserName %></b><br /><br />
<%= this.UserName %> is <%= this.UserAge %> years old and lives in <%=
this.UserCountry %>
I have a repeater with html table inside. In the html table I have a table cell with a check box.
I am trying to get the checked rows from the user after clicking a button but the result is always null.
asp.net markup:
<table id="tbl1" class="table">
<tr>
<th>test 1</th>
<th>test 2</th>
<th>test 3</th>
<th>test 4</th>
<th>Select</th>
</tr>
<asp:Repeater ID="rep" runat="server">
<ItemTemplate>
<tr id="tr1" runat="server">
<td>
<asp:Label ID="lbl1" runat="server" Text='<%#Eval("test1") %>'>' ></asp:Label>
</td>
<td>
<asp:Label ID="lbl2" runat="server" Text='<%#Eval("test2") %>'>' ></asp:Label>
</td>
<td>
<asp:Label ID="lbl3" runat="server" Text='<%#Eval("test3") %>'>' ></asp:Label>
</td>
<td>
<asp:Label ID="lbl4" runat="server" Text='<%#Eval("test4") %>'>' ></asp:Label>
</td>
<td id="td1" runat="server">
<asp:CheckBox ID="Select" runat="server" />
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
<asp:Button ID="btnSelect" runat="server" Text="Go" OnClick="btnSelect_Click" />
C# code:
protected void btnSelect_Click(object sender, EventArgs e)
{
foreach (RepeaterItem rpt in rep.Items)
{
CheckBox ckb = (CheckBox)rpt.FindControl("Select");
if (ckb.Checked) // Always Null
{
//
}
else
{
//
}
}
}
The problem is that you have another server control inside the repeater item. The Checkbox is not directly in the repeater item it is in the table row. You can extract the checkbox like this
CheckBox ckb = (CheckBox)rpt.FindControl("tr1").FindControl("Select");
if (ckb.Checked)
...
Of course this is bad since changing the layout will break your code. To remedy this you can write a recursive FindControl but it requires some more work.
Are you rebinding the DataSource for the Repeater on PostBack? This would cause the state of all the controls in the Repeater to be reset.
The problem might be that rpt.FindControl("Select") only searches only in the children of rpt. You can try this:
/// <summary>
/// Iterates throug all children and returns all of Type T.
/// </summary>
public static List<T> FindChildrenOfType<T>(Control control) where T : class
{
List<T> controls = new List<T>();
foreach (Control childControl in control.Controls)
{
if (childControl.Controls.Count > 0)
{
controls.AddRange(FindChildrenOfType<T>(childControl, comp));
}
if (childControl is T)
{
controls.Add(childControl as T);
}
}
return controls;
}
Use it like this:
var checkboxes = FindChildrenOfType<CheckBox>(rpt);
You can try this....
Aspx Code:
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:Repeater ID="Repeater1" runat="server" >
<ItemTemplate>
<div>
<asp:CheckBox ID="CategoryID" runat="server" Text='<%# Eval("val") %>' />
</div>
</ItemTemplate>
</asp:Repeater>
<asp:Button Text="Click" OnClick="Button2_Click" runat="server" />
</form>
</body>
</html>
CS Code:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataTable dt = new DataTable();
dt.Columns.Add("val", typeof(string));
for (int i = 0; i < 10; i++)
dt.Rows.Add("testing" + i.ToString());
Repeater1.DataSource = dt;
Repeater1.DataBind();
}
}
protected void Button2_Click(object sender, EventArgs e)
{
string Rpt = "Repeater Items Checked:<br />";
for (int i = 0; i < Repeater1.Items.Count; i++)
{
CheckBox chk = (CheckBox)Repeater1.Items[i].FindControl("CategoryID");
if (chk.Checked)
{
Rpt += (chk.Text + "<br />");
}
}
Response.Write(Rpt);
}
Refrenced By: http://www.codeproject.com/Questions/534719/GetplusSelectedplusCheckboxesplusinplusASPplusRepe
I am developing an calendar user control using Ajax calendar extender.
User control code
<%# Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs" Inherits="WebUserControl" ClientIDMode="Predictable" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxControl" %>
<link rel="stylesheet" href="GridViewCSSThemes/YahooGridView.css" type="text/css" media="screen" />
<div style="position:relative;border:none;">
<asp:TextBox ID="txtDate" MaxLength="10" ToolTip="DD/MM/YYYY" Width="100"
CssClass="tb10" runat="server">
</asp:TextBox>
<asp:ImageButton ImageUrl="~/GridViewCSSThemes/Images/Calendar_scheduleHS.png" ID="imgCalender" runat="Server"
BorderWidth="0" ImageAlign="absmiddle" />
<ajaxControl:CalendarExtender ID="AjaxCalenderCtrl" runat="server" Format="dd/MM/yyyy" PopupPosition ="TopLeft"
TargetControlID="txtDate" CssClass="red" FirstDayOfWeek="Sunday" PopupButtonID="imgCalender">
</ajaxControl:CalendarExtender>
<ajaxControl:TextBoxWatermarkExtender WatermarkCssClass="tb10" ID="txtWaterMarkDate"
runat="server" WatermarkText="DD/MM/YYYY" TargetControlID="txtDate">
</ajaxControl:TextBoxWatermarkExtender>
<ajaxToolkit:MaskedEditExtender ID="MaskedEdit_dt" runat="server"
TargetControlID="txtDate"
Mask="99/99/9999"
MessageValidatorTip="true"
OnFocusCssClass="MaskedEditFocus"
OnInvalidCssClass="MaskedEditError"
MaskType="Date"
AcceptAMPM="true"
AcceptNegative="Left"
ErrorTooltipEnabled="True" />
<ajaxToolkit:MaskedEditValidator ID="MaskedEditV_dt" runat="server"
ControlExtender="MaskedEdit_dt"
ControlToValidate="txtDate"
EmptyValueMessage="Date is required"
InvalidValueMessage="Date is invalid"
Display="Dynamic"
TooltipMessage="Input a date"
EmptyValueBlurredText="Date is required"
InvalidValueBlurredMessage="Date is invalid"
IsValidEmpty="false"
ValidationGroup="MKE" />
<%--<asp:RegularExpressionValidator ID="regexpvalEndDateEdit" ErrorMessage="!" ValidationExpression="(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d"
ControlToValidate="txtDate" runat="server"></asp:RegularExpressionValidator>--%>
</div>
Code behind user control
internal string _DValue;
public string DValue
{
get
{
if (_DValue == "")
{
_DValue = txtDate.Text;
}
else
{
txtDate.Text = _DValue;
}
return _DValue;
}
set { _DValue = value; }
}
public string IdClientId
{
get { return this.ClientID; }
}
protected void Page_Load(object sender, EventArgs e)
{
}
I am able to get controls value using server side code.
Now i need to access text-box(txtDate) value and MaskedEditValidator(MaskedEditV_dt) inerHtml from javascript.
How can i do this.
Edit-1
User control in aspx page
<%# Page Language="C#" AutoEventWireup="true" CodeFile="CustomControlTest2.aspx.cs" Inherits="CustomControlTest2" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxControl" %>
<%# Register TagPrefix="uc1" TagName="UCCalender" Src="~/WebUserControl.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>User Control Test</title>
</head>
<body>
<form id="form1" runat="server">
<ajaxToolkit:ToolkitScriptManager runat="server" ID="ScriptManager1" EnablePageMethods="true" />
<div>
<table>
<tr>
<td>
<uc1:UCCalender ID="UCCalStartDate" runat="server" DValue="" />
</td>
</tr>
<tr>
<td>
<asp:Button ID="btnExe" runat="server" Text="Submit" onclick="btnExe_Click" />
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblMsg" runat="server" Text="Label"></asp:Label>
</td>
</tr>
</table>
</div>
</form>
Code behind
protected void btnExe_Click(object sender, EventArgs e)
{
lblMsg.Text = UCCalStartDate.DValue;
}
ASP.NET loads to display the UserControl, it ONLY renders the contents of the UserControl. The Controls in the usercontrol will rendered with the ID as $content_UControlName_Control. You can check this after the rendering the page. You can access the contol using that ID from Javascript like document.getElementById(content_UControlName_Control).
Finally i got answer. Thanks to Nag
On button click
<asp:Button ID="btnExe" runat="server" Text="Submit" OnClientClick="getValue('UCCalStartDate_txtDate','UCCalStartDate_MaskedEditV_dt');" onclick="btnExe_Click" />
Javascript
function getValue(id,msk) {
alert(document.getElementById(id).value);
alert(document.getElementById(msk).innerHTML);
}
Finaly i am able to access calander control's text-box value using java-script
The visible function doesnt work, but why? Is a true set in a callback not allowed?. When I set the visible to true on top of the page(_Default : System.Web.UI.Page) it is working.
information_remedyID.Visible = true;
information_remedyID.Text = inquiryId;
TOP Class:
public partial class _Default : System.Web.UI.Page
{
.......
private static string inquiryId;
......
private void InsertIncidentCallback(server3.ILTISAPI api, IAsyncResult result, string username, string msg_id)
{
string message;
api.EndInsertIncident(result, out message);
if (message == null)
{
string responseXML;
api.REMEDY_ReadResponseXML(username, out responseXML, out msg_id);
XDocument doc = XDocument.Parse(responseXML);
inquiryId = (string)doc.Root.Element("inquiry_id");
if (inquiryId == null | inquiryId == "")
{
information_text.Text = "....";
}
else
{
information_remedyID.Visible = true;
information_remedyID.Text = inquiryId;
//create_LanDesk(computer_idn, swidn_choice, swName_choice, inquiryId);
}
}
else
{
information_text.Visible = true;
information_text.Text = "...";
}
}
}
asp:
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Willkommen im BISS</title>
</head>
<body>
<form id="form1" runat="server">
<span style="font-size: 16pt"><strong>BISS<br />
</strong><span style="font-size: 12pt">
<br />
Angemeldet als:
<asp:Label ID="user_id" runat="server" Text="user_id"></asp:Label><br />
Hostname:
<asp:Label ID="hostname_id" runat="server" Text="hostname_id"></asp:Label>
<br />
CI Nummer:
<asp:Label ID="CI_NR" runat="server" Text="CI_NR"></asp:Label></span></span>
<br />
<br />
<asp:DropDownList ID="softwarelist" runat="server" DataTextField="SoftwareName" DataValueField="SoftwareName">
<asp:ListItem Text="Bitte Software auswählen" Value=""></asp:ListItem>
</asp:DropDownList>
<asp:Button ID="requestbt" runat="server" OnClick="Button1_Click" Text="Software zuweisen" /><br />
<asp:Label ID="information_text" runat="server" Text="information_text" Visible="False"></asp:Label><br />
<asp:Label ID="information_remedyID" runat="server" Text="information_remedyID" Visible="False"></asp:Label>
<br />
</form>
</body>
</html>
Do you use a UpdatePanel with UpdateMode="Conditional"
<asp:UpdatePanel ID="ProfileEditingUpdatePanel" runat="server" UpdateMode="Conditional">
In case you use WPF
information_remedyID.Visibility = Visibility.Visible;
Sorry, overread ASP!
if (inquiryId == null | inquiryId == "")
If this should be an or change it to a double stripe:
if (inquiryId == null || inquiryId == "")
Use a UpdatePanel, like this:
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Willkommen</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="MyUpdatePanel" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<span style="font-size: 16pt">
<strong>
BISS<br />
</strong>
<span style="font-size: 12pt">
<br />
Angemeldet als:
<asp:Label ID="user_id" runat="server" Text="user_id"></asp:Label><br />
Hostname:
<asp:Label ID="hostname_id" runat="server" Text="hostname_id"></asp:Label>
<br />
CI Nummer:
<asp:Label ID="CI_NR" runat="server" Text="CI_NR"></asp:Label></span></span>
<br />
<br />
<asp:DropDownList ID="softwarelist" runat="server" DataTextField="SoftwareName" DataValueField="SoftwareName">
<asp:ListItem Text="Bitte Software auswählen" Value=""></asp:ListItem>
</asp:DropDownList>
<asp:Button ID="requestbt" runat="server" OnClick="Button1_Click" Text="Software zuweisen" /><br />
<asp:Label ID="information_text" runat="server" Text="information_text" Visible="False"></asp:Label><br />
<asp:Label ID="information_remedyID" runat="server" Text="information_remedyID" Visible="False"></asp:Label>
<br />
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>
And in your code, after you changed the visibility:
MyUpdatePanel.Update();
I couldn't get this to work either.
A workaround is to use Style="display: none;" instead of Visible="False". Then you can reveal it with
information_remedyID.Style["display"] = "initial";