Hi,
It is hard to find what is the problem here. I created a new page just creating some radio buttons dynamically and setting the check event and that worked fine, but I am still with that error in my code. If I press ingnore after that error it shows me the followin message:
Server Error in '/ChampWeb' Application.
The control with ID 'RadioHotTopic2' not found
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: The control with ID 'RadioHotTopic2' not found
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): The control with ID 'RadioHotTopic2' not found] Ext.Net.ResourceManager.RaisePostBackEvent(String eventArgument) +1083 System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +175 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3614
I putted my whole code here to see if can help me.
<%@ Page Language="C#" AutoEventWireup="True" CodeBehind="iNed.aspx.cs" Inherits="ChampWeb.iNed" Title="<%$ Resources:Resource, pageTitle %>"%>
<%@ Import Namespace="System.ComponentModel" %>
<%@ Import Namespace="System.Xml.XPath" %>
<%@ Import Namespace="System.Data"%>
<%@ Import Namespace="System.Data.SqlClient"%>
<%@ Import Namespace="System.Threading"%>
<%@ Import Namespace="System.Globalization"%>
<%@ Import Namespace="ChampWeb.Util" %>
<%@ Import Namespace="ChampWeb.Data" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="App_Themes/ChampWeb/Default.css" rel="stylesheet" type="text/css" />
<title></title>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
// Update xml playlist file from DB
MessageBoxConfig msg = new MessageBoxConfig();
msg.Message = XMLManagement.AddMP3s();
if (msg.Message != null)
{
X.MessageBox.Show(msg);
X.MessageBox.Call("getDialog().setPosition", new object[] { 0, 0 });
}
FlashComponentRadioNedActive.Url = this.ResolveUrl(@"~\App_Themes\ChampWeb\Animations\iNedActive.swf");
loadHotTopics();
}
}
protected void loadHotTopics()
{
string ConnectionString = ConfigurationManager.ConnectionStrings["JTechConsulting.Data.Orm.SqlServer"].ConnectionString;
int hotTopicNumber = setHotTopics(ConnectionString);
if (hotTopicNumber >= 2)
{
string hotTopicVoteID = getUserVote(ConnectionString);
if (hotTopicVoteID != null && !String.IsNullOrEmpty(hotTopicVoteID))
{
selectHotTipic(hotTopicVoteID, hotTopicNumber);
this.ImageButtonVote.Disabled = true;
}
if (hotTopicNumber > 2)
{
int panelHeight = Convert.ToInt32(this.PanelHotTopicsContent.Height.Value) + ((hotTopicNumber - 2) * 57);
this.PanelHotTopicsContent.Height = panelHeight;
}
}
else
{
this.PanelHotTopicsContent.Hidden = true;
}
}
protected int setHotTopics(string ConnectionString)
{
string hotTopicID;
string hotTopicDescription;
int hotTopicNumber = 0;
string culture = Session["curCulture"].ToString();
string hotTopicLabel = (String)GetGlobalResourceObject("Resource", "LabelTotalHotTopicVote");
HOTTOPICFactory hotTopicFactory = new HOTTOPICFactory();
BindingList<HOTTOPIC> hotTopics = hotTopicFactory.FetchCurrentHotTopics(ConnectionString, culture);
foreach (HOTTOPIC curHotTopic in hotTopics)
{
hotTopicNumber++;
hotTopicID = curHotTopic.ID.ToString();
hotTopicDescription = curHotTopic.DESCRIPTION;
Ext.Net.Radio RadioHotTopic = new Ext.Net.Radio();
RadioHotTopic.ID = "RadioHotTopic" + hotTopicNumber.ToString();
RadioHotTopic.BoxLabel = setHotTopicsDescription(hotTopicDescription);
RadioHotTopic.Tag = hotTopicID;
RadioHotTopic.GroupName = "hotTopics";
RadioHotTopic.Cls = "radioButtonHotTopics";
RadioHotTopic.DirectEvents.Check.Event += RadioButton_Check;
PanelHotTopicsContent.Add(RadioHotTopic);
setTotalValuesToHotTopic(ConnectionString, int.Parse(hotTopicID));
}
return hotTopicNumber;
}
protected void setTotalValuesToHotTopic(string ConnectionString, int hotTopicID)
{
SqlConnection conn = null;
SqlCommand cmd = null;
try
{
string hotTopicDescription;
string hotTopicTotalText = (String)GetGlobalResourceObject("Resource", "LabelTotalHotTopicVote");
// Retrieves the total of votes for an specific Hot topic.
string CommandText = "SELECT Count(*)" +
" FROM HOTTOPICVOTE" +
" WHERE (HOTTOPICID = @hotTopicID)";
// Open connection to the database
conn = new SqlConnection(ConnectionString);
conn.Open();
cmd = new SqlCommand(CommandText);
cmd.Connection = conn;
// Add paramters
cmd.Parameters.Add(new SqlParameter("@hotTopicID", System.Data.SqlDbType.Int));
// Set total votes to hot topics
cmd.Parameters["@hotTopicID"].Value = hotTopicID;
Ext.Net.Label LabelTotalHotTopicVote = new Ext.Net.Label();
LabelTotalHotTopicVote.Text = Convert.ToString(cmd.ExecuteScalar()) + " " + hotTopicTotalText;
LabelTotalHotTopicVote.Cls = "labelTotalHotTopics";
this.PanelHotTopicsContent.Add(LabelTotalHotTopicVote);
}
catch (Exception ex)
{
// Print error message
MessageBoxConfig msg = new MessageBoxConfig();
msg.Message = ex.Message;
X.MessageBox.Show(msg);
X.MessageBox.Call("getDialog().setPosition", new object[] { 0, 0 }); //Sets the page XY position ;
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
}
protected string getUserVote(string ConnectionString)
{
BE_USERS be_users;
BE_USERSFactory be_usersFactory = new BE_USERSFactory();
SqlConnection conn = null;
SqlCommand cmd = null;
string result = null;
try
{
string hotTopicID;
string hotTopicDescription;
be_users = be_usersFactory.FetchBE_USERSOnUserName(Page.User.Identity.Name);
// Retrieves the hotTopicID for which the user have voted
string CommandText = "SELECT HOTTOPICVOTE.ID" +
" FROM HOTTOPIC JOIN HOTTOPICVOTE" +
" ON (HOTTOPIC.ID = HOTTOPICVOTE.HOTTOPICID)" +
" WHERE ((STARTDATE <= @today AND ENDDATE >= @today) AND USERID = @userID)";
// Open connection to the database
conn = new SqlConnection(ConnectionString);
conn.Open();
cmd = new SqlCommand(CommandText);
cmd.Connection = conn;
// Add paramters
cmd.Parameters.Add(new SqlParameter("@today", System.Data.SqlDbType.DateTime));
cmd.Parameters.Add(new SqlParameter("@userID", System.Data.SqlDbType.Int));
cmd.Parameters["@today"].Value = DateTime.Now;
cmd.Parameters["@userID"].Value = be_users.USERID;
result = Convert.ToString(cmd.ExecuteScalar());
}
catch (Exception ex)
{
// Print error message
MessageBoxConfig msg = new MessageBoxConfig();
msg.Message = ex.Message;
X.MessageBox.Show(msg);
X.MessageBox.Call("getDialog().setPosition", new object[] { 0, 0 }); //Sets the page XY position ;
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
return result;
}
protected void selectHotTipic(string hotTopicVoteID, int hotTopicNumber)
{
HOTTOPICVOTE hotTopicVote;
HOTTOPICVOTEFactory hotTopicVoteFactory = new HOTTOPICVOTEFactory();
hotTopicVote = hotTopicVoteFactory.FetchHOTTOPICVOTE(int.Parse(hotTopicVoteID));
string hotTopicID = hotTopicVote.HOTTOPICID.ToString();
Session["hotTopicVoteID"] = hotTopicVoteID;
for (int curHotTopic = 1; curHotTopic < hotTopicNumber; curHotTopic++)
{
Ext.Net.Radio RadioHotTopic = (Ext.Net.Radio)this.PanelHotTopicsContent.FindControl("RadioHotTopic" + curHotTopic);
if (RadioHotTopic.Tag == hotTopicID)
{
RadioHotTopic.Checked = true;
}
}
}
protected string setHotTopicsDescription(string hotTopicDescription)
{
if (!String.IsNullOrEmpty(hotTopicDescription))
{
string description1 = null;
string description2 = null;
if (hotTopicDescription.Length > 32)
{
description1 = hotTopicDescription.Substring(0, 32);
int pos = description1.LastIndexOf(" ");
description1 = hotTopicDescription.Substring(0, pos + 1);
if (hotTopicDescription.Length > 64)
{
description2 = " " + hotTopicDescription.Substring(pos + 1, 32);
hotTopicDescription = description1 + description2 + " " + hotTopicDescription.Substring(63);
}
else
{
description2 = " " + hotTopicDescription.Substring(pos + 1);
hotTopicDescription = description1 + description2;
}
}
}
return hotTopicDescription;
}
protected void ComboBoxAvatarTopics_Select(object sender, DirectEventArgs e)
{
int topicID = int.Parse(this.comboBoxAvatarTopics.SelectedItem.Value.ToString());
DataBaseManagement.updateUsageTable(topicID);
HttpContext.Current.Session["assetSelected"] = topicID;
this.labelRatingAvatarTopics.Hidden = false;
this.labelRatingMp3.Hidden = true;
}
protected void RadioButton_Check(object sender, DirectEventArgs e)
{
MessageBoxConfig msg = new MessageBoxConfig();
msg.Message = "Hello Radio";
X.MessageBox.Show(msg);
}
protected void ImageButtonVote_Click(object sender, DirectEventArgs e)
{
BE_USERS be_users;
HOTTOPICVOTEFactory hotTopicsVoteFactory = new HOTTOPICVOTEFactory();
BE_USERSFactory be_usersFactory = new BE_USERSFactory();
be_users = be_usersFactory.FetchBE_USERSOnUserName(Page.User.Identity.Name);
string hotTopicID = null;
foreach(Control curControl in PanelHotTopicsContent.Controls)
{
if (curControl is Ext.Net.Radio)
{
Ext.Net.Radio curRadioHotTopic = (Ext.Net.Radio)curControl;
if (curRadioHotTopic.Checked)
{
hotTopicID = curRadioHotTopic.Tag;
}
}
}
if (hotTopicID != null)
{
// The current culture is changed temporarily to save the date in the format US
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US");
// Verifies if the user have not vote yet
if (Session["hotTopicVoteID"] == null)
{
HOTTOPICVOTE hotTopicsVote = new HOTTOPICVOTE();
string ConnectionString = ConfigurationManager.ConnectionStrings["JTechConsulting.Data.Orm.SqlServer"].ConnectionString;
hotTopicsVote.USERID = be_users.USERID;
hotTopicsVote.HOTTOPICID = int.Parse(hotTopicID);
hotTopicsVote.VOTEDON = DateTime.Now;
hotTopicsVoteFactory.Insert(hotTopicsVote);
Session["hotTopicVoteID"] = getUserVote(ConnectionString);
}
else
{
// If the user already voted it changes the vote
int hotTopicVoteID = Convert.ToInt32(Session["hotTopicVoteID"]);
HOTTOPICVOTE hotTopicsVote = hotTopicsVoteFactory.FetchHOTTOPICVOTE(hotTopicVoteID);
hotTopicsVote.HOTTOPICID = int.Parse(hotTopicID);
hotTopicsVote.VOTEDON = DateTime.Now;
hotTopicsVoteFactory.Update(hotTopicsVote);
}
if (Session["curCulture"] != null)
{
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Session["curCulture"].ToString());
}
}
this.ImageButtonVote.ImageUrl = "App_Themes/ChampWeb/Images/imaBtnStandar_Vote_Out.png";
this.ImageButtonVote.Disabled = true;
}
[System.Web.Services.WebMethod(EnableSession=true)]
public static void updateAssetRating(string rating)
{
if (HttpContext.Current.Session["assetSelected"] != null)
{
int assetID = int.Parse(HttpContext.Current.Session["assetSelected"].ToString());
MessageBoxConfig msg = new MessageBoxConfig();
msg.Message = DataBaseManagement.updateAssetRatingTable(assetID, int.Parse(rating));
if (msg.Message != null)
{
X.MessageBox.Show(msg);
X.MessageBox.Call("getDialog().setPosition", new object[] { 0, 0 });
}
}
}
[System.Web.Services.WebMethod(EnableSession = true)]
public static void updateMp3Usage(string mp3ID)
{
HttpContext.Current.Session["assetSelected"] = mp3ID;
MessageBoxConfig msg = new MessageBoxConfig();
msg.Message = DataBaseManagement.updateUsageTable(int.Parse(mp3ID));
if (msg.Message != null)
{
X.MessageBox.Show(msg);
X.MessageBox.Call("getDialog().setPosition", new object[] { 0, 0 });
}
}
</script>
<script language="JavaScript" type="text/javascript" src="http://vhss-d.oddcast.com/vhost_embe...js=1"></script>
<script language="JavaScript" type="text/javascript">
function vh_sceneLoaded(sceneIndex){
sayAIResponse('Give WIN intro', 2, 1, 3);
}
function video()
{
try
{
var video = document.getElementById("video");
var comboBoxContent = document.getElementById("comboBoxContent");
var rate = document.getElementById("rate");
if (video.style.display = 'none')
{
video.style.display='block';
comboBoxContent.style.display='block';
rate.style.display='none';
rate.style.top ='650px';
var comboBoxAvatarTopics = document.getElementById("comboBoxAvatarTopics");
if (comboBoxAvatarTopics != null)
{
comboBoxAvatarTopics.value = "Choose a Topic" ;
comboBoxContent.hidden = false;
}
}
}
catch(err)
{
alert(err.description);
}
}
function novideo()
{
var video = document.getElementById("video");
var comboBoxContent = document.getElementById("comboBoxContent");
var comboBoxAvatarTopics = document.getElementById("comboBoxAvatarTopics");
var rate = document.getElementById("rate");
var labelRatingMp3 = document.getElementById("labelRatingMp3");
var labelRatingAvatarTopics = document.getElementById("labelRatingAvatarTopics");
video.style.display='none';
comboBoxContent.style.display='none';
rate.style.display='none';
labelRatingMp3.className = "x-label x-show-display";
labelRatingAvatarTopics.className = "x-label x-hide-display";
}
var AskNed = function(el)
{
var sayToNed = el.lastSelectionText;
var rate = document.getElementById("rate");
sayAIResponse(sayToNed, 2, 1, 3);
rate.style.display='block';
showRatingAnimation();
};
function rating(rate)
{
PageMethods.updateAssetRating(rate);
}
// Function made from TSPlayer
function songPlaying(id)
{
PageMethods.updateMp3Usage(id);
rate.style.display='block';
showRatingAnimation();
}
function showIPlayer(swfName)
{
var swfUrl = './Audio/SECURE-TSPlayerV4.5.swf';
swfobject.embedSWF(swfUrl, "iPlayerContainer", "680", "415", "10.0.0", "expressInstall.swf");
PageMethods.updateUsage(swfName);
}
function showRatingAnimation()
{
var swfUrl = "./App_Themes/ChampWeb/Animations/rateMe.swf";
swfobject.embedSWF(swfUrl, "ratingSwf", "250", "30", "10.0.0", "expressInstall.swf",{}, {bgcolor: '#FFFFA9'});
}
</script>
<style type="text/css">
.x-combo-list .x-combo-selected
{
background: #D8D855 !important;
}
.x-form-item.x-form-label-top label.x-form-item-label
{
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
font-size:16px;
color:#FFC200;
text-align: center;
}
.x-combo-list .x-combo-selected
{
background-color: #002E12;
border-color: #002E12 !important;
color: #00631C;
}
.ext-strict .x-form-text
{
border-style: none;
margin-right:1px;
}
.x-form-field-wrap .x-form-trigger
{
height: 19px !important;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" CleanResourceUrl="false">
</ext:ResourceManager>
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" EnablePartialRendering="true">
</asp:ScriptManager>
<ext:FlashComponent ID="FlashComponentRadioNedActive" runat="server" Height="0px" Width="0px"/>
<ext:Store ID="StoreAvatarTopics" runat="server" DataSourceID="ObjectDataSourceAssetTopics">
<Reader>
<ext:JsonReader>
<Fields>
<ext:RecordField Name="ID" />
<ext:RecordField Name="TITLE" />
<ext:RecordField Name="DISPLAYORDER" />
</Fields>
</ext:JsonReader>
</Reader>
<SortInfo Field="DISPLAYORDER" Direction="ASC" />
</ext:Store>
<div id="video">
<script type="text/javascript">AC_VHost_Embed(1185660, 300, 353, '', 1, 1, 1865677, 0, 1, 0, '86c5e6a3e4148e9e6da96074dff5d564', 9);</script>
</div>
<div id="comboBoxContent">
<ext:ComboBox id="comboBoxAvatarTopics" runat="server" StoreID="StoreAvatarTopics" DisplayField="TITLE"
ValueField="ID" Width="387px" Height="21px" FieldLabel="Call Dr. Ned About "
cls="comboBoxAvatarTopics" LabelAlign="Top" Text="<%$ Resources: comboBoxAvatarTopics.Text %>">
<Listeners>
<Select Fn="AskNed" />
</Listeners>
<DirectEvents>
<Select OnEvent="ComboBoxAvatarTopics_Select"/>
</DirectEvents>
</ext:ComboBox>
</div>
<div id="iPlayerContainer">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/s...ersion=7,0,0,0" width="800" height="800">
<param name="movie" value="Audio/SECURE-TSPlayerV4.5.swf" />
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<param name="FlashVars" value="playlistfile=Audio/playlist.xml&configurationfile=Audio/configuration.xml&js=songPlaying" />
<embed src="Audio/SECURE-TSPlayerV4.5.swf" quality="high" wmode="transparent" flashvars="playlistfile=Audio/playlist.xml&configurationfile=Audio/configuration.xml&js=songPlaying" pluginspage="http://www.macromedia.com/shockwave/...ShockwaveFlash" type="application/x-shockwave-flash" width="800" height="800"></embed>
</object>
</div>
<div id="rate">
<div class="labelRatingClase">
<ext:Label ID="labelRatingAvatarTopics" Text="" Cls="labelRating" runat="server"
Hidden="true" meta:resourcekey="labelRatingAvatarTopics">
</ext:Label>
<ext:Label ID="labelRatingMp3" runat="server" Cls="labelRating" Hidden="true"
meta:resourcekey="labelRatingMp3">
</ext:Label>
<div id="ratingSwf">
</div>
</div>
</div>
<div class="panelHotTopics">
<ext:Panel ID="PanelHotTopicsContent" runat="server" Height="220px" Width="225px" BodyCssClass="panelHotTopicsBody"
Title="<%$ Resources: PanelHotTopicsContent.Title %>">
<Content>
<div class="buttonsHotTopicsContent">
<ext:ImageButton ID="ImageButtonVote" runat="server"
ImageUrl="App_Themes/ChampWeb/Images/imaBtnStandar_Vote_Out.png"
OverImageUrl="App_Themes/ChampWeb/Images/imaBtnStandar_Vote_Over.png">
<DirectEvents>
<Click OnEvent="ImageButtonVote_Click" />
</DirectEvents>
</ext:ImageButton>
</div>
</Content>
</ext:Panel>
</div>
<asp:ObjectDataSource ID="ObjectDataSourceAssetTopics" runat="server"
SelectMethod="FetchASSETOnASSETTYPE" TypeName="ChampWeb.Data.ASSETFactory">
<SelectParameters>
<asp:Parameter DefaultValue="3" Name="ASSETTYPE" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
</form>
</body>
</html>