E
Eric Lemmon
Hello C# Gurus,
Please excuse my VB mindset.
I am writing a class library in C# that is used by a VB ASP.NET app. When SQL Server detects a data validation exception, I want to use a C# function within the library to alert the user and send focus to the offending control.
In VB.NET, I can code something like this (where I just put a runat=server onto the <BODY> tag and named it BodyTag) :
DirectCast(Page.FindControl("BodyTag"), _
HtmlGenericControl).Attributes. _
Item("onload") &= "alert('Data Invalid');"
Is there an equivalent statement for C# that can reference a control attribute by name? Whenever I try to reference an item in the Attributes collection, it barks at me because item does not exist. Trying to use the Keys collection does not work either because it is not indexed.
I would just use the Attributes.Add method, but I cannot overwrite the existing onload attribute; I can only append to it.
Many thanks,
Eric
Please excuse my VB mindset.
I am writing a class library in C# that is used by a VB ASP.NET app. When SQL Server detects a data validation exception, I want to use a C# function within the library to alert the user and send focus to the offending control.
In VB.NET, I can code something like this (where I just put a runat=server onto the <BODY> tag and named it BodyTag) :
DirectCast(Page.FindControl("BodyTag"), _
HtmlGenericControl).Attributes. _
Item("onload") &= "alert('Data Invalid');"
Is there an equivalent statement for C# that can reference a control attribute by name? Whenever I try to reference an item in the Attributes collection, it barks at me because item does not exist. Trying to use the Keys collection does not work either because it is not indexed.
I would just use the Attributes.Add method, but I cannot overwrite the existing onload attribute; I can only append to it.
Many thanks,
Eric