Click here to Skip to main content
15,891,136 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: how to check a checkbox in the onClick event of an asp:TextBox in a gridview Pin
Abhijit Jana21-Dec-08 20:40
professionalAbhijit Jana21-Dec-08 20:40 
GeneralRe: how to check a checkbox in the onClick event of an asp:TextBox in a gridview Pin
Christian Graus21-Dec-08 20:48
protectorChristian Graus21-Dec-08 20:48 
GeneralRe: how to check a checkbox in the onClick event of an asp:TextBox in a gridview Pin
Abhijit Jana21-Dec-08 21:04
professionalAbhijit Jana21-Dec-08 21:04 
GeneralRe: how to check a checkbox in the onClick event of an asp:TextBox in a gridview Pin
N a v a n e e t h21-Dec-08 20:44
N a v a n e e t h21-Dec-08 20:44 
GeneralRe: how to check a checkbox in the onClick event of an asp:TextBox in a gridview Pin
_AK_21-Dec-08 20:47
_AK_21-Dec-08 20:47 
GeneralRe: how to check a checkbox in the onClick event of an asp:TextBox in a gridview Pin
_AK_21-Dec-08 20:21
_AK_21-Dec-08 20:21 
AnswerRe: how to check a checkbox in the onClick event of an asp:TextBox in a gridview Pin
Parwej Ahamad21-Dec-08 19:41
professionalParwej Ahamad21-Dec-08 19:41 
QuestionC# syntax question Pin
Nostrom021-Dec-08 19:21
Nostrom021-Dec-08 19:21 
I'd like to make a change to an existing ASP.NET 2.0 commerce site so that certain products are flagged with a warning label. The website's product details page already uses such boolean-triggered flags for other product information, so I have copied the existing format to add a path for this additional boolean field from the .cs page back through the DAL, the stored procedure, and the database's products table.

I have the new flag's [b]asp:Image[/b] tag in place on the .aspx page, but I am not sure where to place the switching code on the .cs page so as not to create a compile or runtime error.

Here is a cut-down version of the Product Detail page's .cs file showing what I hope are the relevant parts; a copy of the full .cs page is here:
namespace MySite
{
	public partial class productdetail : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.Image Image1;
                //[a series of WebControl declarations here]
		protected System.Web.UI.WebControls.Image imgNew;
                //["imgNew" is one of the existing boolean flags]

public void BindTheData()
	{
		.... code ....

			if (!errorFlg)
			{
				if (dataset.Tables[0].Rows.Count > 0)
				{
				DataRow tr = dataset.Tables[0].Rows[0];
				imgProduct.ImageUrl = "images/products/" +tr["IMAGEFILE_NM"].ToString();
				litName.Text = "<h3 id='detName'>" + tr["NAME"].ToString() +"</h3>";
					//Create the grades label
					string from_grade = tr["FROM_GRADE"].ToString();
					string to_grade = tr["TO_GRADE"].ToString();
					if (from_grade.Length > 0 && to_grade.Length > 0)
					{
						lbGrades.Text = "Grades "+ from_grade + " - " + to_grade;
					}
					if (from_grade == to_grade)
					{
						lbGrades.Text = "Grade "+ from_grade;
					}
					if (from_grade.Length > 0 && to_grade.Length == 0)
					{
						lbGrades.Text = "Grades "+ from_grade + "+";
					}
					if (from_grade.Length == 0 && to_grade.Length == 0)
					{
						lbGrades.Text = "";
					}

					lbContent.Text = tr["NSES_NM"].ToString();
					lbDescription.Text = tr["DESCRIPTION"].ToString();

			
                      //Remove these icons from the ProductLine1/ProductLine11 products

					string topic_id = tr["TOPIC_CD"].ToString();
					if (topic_id != "1" || topic_id != "11")
					{
                        //Format the image icons representing award, resource

						string awardFlg = tr["award_flg"].ToString();
						string ResourceFlg = tr["resource_flg"].ToString();
						if (awardFlg == "1")
						{
							imgAward.Visible = true;
						}
						if (ResourceFlg == "1")
						{
							imgResource.Visible = true;
						}

					}
.....code.....
}

I want the flags to apply to all products, not just the "if (topic_id != "1" || topic_id != "11"" ones mentioned above. I have tried to insert a copy of the code for one of the preexisting flags:
string MyNewFlg = tr["my_new_flg"].ToString();
if (MyNewFlg == "1")
    {
    imgMyNewFlag.Visible = true;
    }

If I place the new flag code either inside or outside of the topic_id exclusion the solution builds OK, I get the following runtime error:
Column 'my_new_flg' does not belong to table Table...<br />
Exception Details: System.ArgumentException: Column 'my_new_flg' does not belong to table Table.

Is the code I am imitating creating some sort of dynamic table, and that is causing the screwup? Should I be using something like
if (productTable.MyNewFlagColumn > 0)
            {
               MyNewFlag.Visible = true;
            }
?
Thanks for any advice.
QuestionThe type or namespace Couldn't be Loded Pin
dibya_200321-Dec-08 19:21
dibya_200321-Dec-08 19:21 
AnswerRe: The type or namespace Couldn't be Loded Pin
StianSandberg21-Dec-08 19:59
StianSandberg21-Dec-08 19:59 
GeneralRe: The type or namespace Couldn't be Loded Pin
Christian Graus21-Dec-08 20:03
protectorChristian Graus21-Dec-08 20:03 
GeneralRe: The type or namespace Couldn't be Loded Pin
dibya_200321-Dec-08 21:34
dibya_200321-Dec-08 21:34 
GeneralRe: The type or namespace Couldn't be Loded Pin
Christian Graus21-Dec-08 22:45
protectorChristian Graus21-Dec-08 22:45 
Question[Message Deleted] Pin
Alok Sharma ji21-Dec-08 19:02
Alok Sharma ji21-Dec-08 19:02 
AnswerRe: hi friends i am stuck with file uploading and retrivence, Pin
Christian Graus21-Dec-08 19:11
protectorChristian Graus21-Dec-08 19:11 
GeneralRe: hi friends i am stuck with file uploading and retrivence, Pin
Alok Sharma ji21-Dec-08 19:25
Alok Sharma ji21-Dec-08 19:25 
AnswerRe: hi friends i am stuck with file uploading and retrivence, Pin
Alok Sharma ji21-Dec-08 19:21
Alok Sharma ji21-Dec-08 19:21 
GeneralRe: hi friends i am stuck with file uploading and retrivence, Pin
Christian Graus21-Dec-08 19:27
protectorChristian Graus21-Dec-08 19:27 
GeneralRe: hi friends i am stuck with file uploading and retrivence, Pin
AprNgp21-Dec-08 20:40
AprNgp21-Dec-08 20:40 
GeneralRe: hi friends i am stuck with file uploading and retrivence, Pin
Alok Sharma ji21-Dec-08 21:17
Alok Sharma ji21-Dec-08 21:17 
GeneralRe: hi friends i am stuck with file uploading and retrivence, Pin
Christian Graus21-Dec-08 22:46
protectorChristian Graus21-Dec-08 22:46 
QuestionHow to set background image of button in asp.net? Pin
S a n d y21-Dec-08 18:04
S a n d y21-Dec-08 18:04 
AnswerRe: How to set background image of button in asp.net? Pin
Christian Graus21-Dec-08 19:10
protectorChristian Graus21-Dec-08 19:10 
QuestionQuerystring in Hidden Control Pin
kavitha_blueindia21-Dec-08 14:22
kavitha_blueindia21-Dec-08 14:22 
AnswerRe: Querystring in Hidden Control Pin
N a v a n e e t h21-Dec-08 15:10
N a v a n e e t h21-Dec-08 15:10 

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.