|
I'm trying to create a .NET server control that is basically an enhanced Panel control. However, just inheriting from the Panel class is not enough; when I place another control inside the enhanced control, I get an error (e.g. Type "MyPanel" does not have a property named 'asp:label').
Do I just need to implement another interface, or do I need to create a completely different type of control?
|
|
|
|
|
MS le Roux wrote:
I'm trying to create a .NET server control that is basically an enhanced Panel control. However, just inheriting from the Panel class is not enough; when I place another control inside the enhanced control, I get an error (e.g. Type "MyPanel" does not have a property named 'asp:label').
Wow, what a dig! Just spent the last two hours figuring this one out, luckily I had to figure it out for my own project
Ok this is all rather confusing and I don't have all the answers in the right place but basically there are quite a few control types which you can build in ASP.NET. There are User Controls, Composite Controls, Template Controls etc. etc. All rather confusing and so far I have not seen the point, but anyway.
Basically what you are trying to do is contain one User Control in another User Control, which is not really "proper", you are "supposed" to use a Template Control, I think, to do that.
But you CAN do it using User Controls and it involves on very important attribute that needs to be set in your class. Namely: ParseChildren
By default it is set to true (which I think is daft) but for your purposed you need to set it to false. You put it in your ascx.cs class like so:
...
namespace rka_revamp.components
{
[
ParseChildren(false)
]
public abstract class __dmenu : System.Web.UI.UserControl
{
...
That basically tells ASP.NET that any children of your User Control are NOT properties of that User Control. Sounds a bit daft if you ask me, but it works!
Then you also need to override the Render method to loop through the chidren controls.
Here are the two web pages which showed me how to do it (I love you Google!):
http://www.dotnet247.com/247reference/msgs/14/71007.aspx[^] (the answer is nearly at the bottom of the long question/answer series)
and
http://www.oreillynet.com/pub/a/dotnet/excerpt/progaspdotnet_14/index2.html?page=5[^]
If none of the above makes sense then send me your code and I can then tell you exactly what to do
|
|
|
|
|
Yes, you're right about the ParseChildren attribute. After I posted my message, I discovered just what this little attribute does, and when I set it to false, my stuff started working. Thanks for the links, I'll read the articles. (Guess it helps to know just what the correct search term is for Google.)
|
|
|
|
|
HI all....
Can u help me in this,
I have MS Office 2000 installed with all options. I want to setup a database using the MS-Access, to access the database for my ASP applications. What should I do?
Mine is Windows 2000 professional.
Thanks in advance,
SPS
|
|
|
|
|
Just Create a DSN For ur access database on the webserver.Then use this dsn name in the connection strings in ur asp/asp.net pages.
Detailed help with coding the same can be found in this website from many examples.
Hope this helps.
Regards
Pradhip.S
Why Need Parking lots in Bars when Drunken Driving is Prohibited
|
|
|
|
|
Yeah.... i tried this, but it still gives error message when the page is loading...
|
|
|
|
|
SPS wrote:
I want to setup a database using the MS-Access, to access the database for my ASP applications. What should I do?
I would suggest to use ASP.NET rather, it is much, much easier than ASP
Before you criticize a man, walk a mile in his shoes. That way, when you do criticize him, you'll be a mile away and have his shoes.
|
|
|
|
|
First let me try whats ASP and then, will jump into ASP.NET and join you soon... ok. Anyway, Thanks
|
|
|
|
|
SPS wrote:
First let me try whats ASP and then, will jump into ASP.NET and join you soon... ok. Anyway, Thanks
I assumed you were new to ASP, that's why I suggested ASP.NET, there's no point in statrting in ASP then moving to ASP.NET, they are worlds apart. Eg. I cant do any ASP myself, but ASP.NET is a breeze. I would seriously recommend you start ASP.NET and stick to it
CHeers
Before you criticize a man, walk a mile in his shoes. That way, when you do criticize him, you'll be a mile away and have his shoes.
|
|
|
|
|
If thats the case..... Thanks for the advice. I will take this a good advice, and move into asp.net. Again... thanks..
|
|
|
|
|
Is it possible to implement a list view control in HTML/javascript? I'm thinking something along the lines of SysListView32 in report mode.
--
Please state the nature of your medical emergency.
|
|
|
|
|
Jörgen Sigvardsson wrote:
Is it possible to implement a list view control in HTML/javascript? I'm thinking something along the lines of SysListView32 in report mode
Anything is possible.
http://webfx.eae.net/webboard/ [^] might have some implementations of what you want.
|
|
|
|
|
Impressive stuff! Unfortunately it doesn't work with Mozilla/Netscape which is one of my requirements. But maybe I'll be able to use some of it - I don't need all that fancy pancy stuff
--
Please state the nature of your medical emergency.
|
|
|
|
|
I think I've come up with a solution. div and table are my friends I believe.
I've never really understood the purpose of div before. But these last few days have really made me aware of its powers.
Maybe, just maybe, I'll be able to make something constructive of blink too..
--
Please state the nature of your medical emergency.
|
|
|
|
|
Jörgen Sigvardsson wrote:
I've never really understood the purpose of div before
A DIV is simply a container to which you can apply CSS reliably, nothing more. Very useful though
Jörgen Sigvardsson wrote:
I'll be able to make something constructive of blink too
Get drunk again and then re-think that blink tag. Imagine the pain inducing blinkness of it during a hangover
|
|
|
|
|
Paul Watson wrote:
Get drunk again and then re-think that blink tag. Imagine the pain inducing blinkness of it during a hangover
ROTFLMAO!!!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
You could use an iframe, and have it display a dynamically generated page
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
I thought about it, but it would be too complex for my backend to handle, I think. I haven't put much thought into it, but I know I'd have to do page to page "marshalling" which doesn't really fit my model.
I've implemented a "GUI" toolkit in Java/JSP. Each page is a form, and each controlling GUI component uses the GET/POST-mechanism and various javascripts to signal events to the server components. And I maintain various states in the frame (my name for a web page), keep internationalizable information, data bound components etc. This model only works well inside page boundaries. I have been pondering though if I could cross the page boundaries and use frames/iframes, but as the project I'm working on doesn't require that, I'll keep it for a rainy sunday or something.
I finally managed to solve the problem using div and table. I got a nice looking list view/report in the end.
--
Please state the nature of your medical emergency.
|
|
|
|
|
Is there any way to have access to properites of user control,in my code behiind?
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Mazdak wrote:
Is there any way to have access to properites of user control,in my code behiind?
Yup, just define your usercontrol in your code behind as you would any normal control.
Remember your usercontrol is effectively the same as any of the "official" controls, no special treatment required.
e.g.
ASPX page:
...
<body>
<RKA:Header id="header" runat="server" CurrentSection="Garden Design" />
...
and then codebehind:
...
public class _template : System.Web.UI.Page
{
public rka_revamp._header header;
private void Page_Load(object sender, System.EventArgs e)
{
header.CurrentSection = true;
}...
|
|
|
|
|
Ages ago I read that when ASP.Net arrived we'd be able to "package" up the whole application so that it could be shipped off to a hosting provider without worrying about them stealing IP.
Did this eventuate? Or is it still on the wish list?
Gracias,
|
|
|
|
|
You can (of sorts). You can produce compiled code that can then be dropped into the /bin directory and off you go. For example, I've produced a few validation controls (they're on CodeProject), you can add the tags into the aspx pages directly, drop in the assembly and you're off. You could produce commercial controls in such a way and thus provide some IP protection.
Since its just IL it is pretty easy to reverse engineer, and there are tools that can produce C# code from a compiled assembly. Consequently, pre-compiling doesn't afford a huge amount of protection. If that's the case you'll need to look at obfuscation.
--
Paul
"I need the secure packaging of Jockeys. My boys need a house!"
- Kramer, in "The Chinese Woman" episode of Seinfeld
MS Messenger: paul@oobaloo.co.uk
Sonork: 100.22446
|
|
|
|
|
I have this code:
public void OnLogin(object sender, System.EventArgs e)
{
if(IsLoginCorrect(User.Text, Pass.Text))
{
FormsAuthentication.RedirectFromLoginPage(User.Text, false);
}
else
{
Error.Text = "Fel, försök igen!";
}
}
public bool IsLoginCorrect(string user, string password)
{
string connectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("mp219.mdb");
OleDbConnection connection = new OleDbConnection(connectString);
try
{
connection.Open();
StringBuilder builder = new StringBuilder();
builder.Append("SELECT COUNT(*) FROM Loin WHERE User = \'");
builder.Append(user);
builder.Append("\' AND CAST (rtrim (Password) as VARBINARY) = CAST(\'");
builder.Append(password);
builder.Append("\' as VARBINARY");
OleDbCommand cmd = new OleDbCommand(builder.ToString(), connection);
int count = (int)cmd.ExecuteScalar();
return (count > 0);
}
catch(Exception e)
{
Response.Write(e.ToString());
return false;
}
finally
{
connection.Close();
}
}
Whyyyyyyyyyyyyyyyyyyy does it throws an eception????????
Is it because the command string isn't correct?
I don't think so... I could be wrong... can you help me!!!???
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
What exception are you getting?
Before you criticize a man, walk a mile in his shoes. That way, when you do criticize him, you'll be a mile away and have his shoes.
|
|
|
|
|
I'm not so sure, but you mite need to set the command before opening the connection, as such:
OleDbCommand myCommand = new OleDbCommand(myScalarQuery, myConnection);
myCommand.Connection.Open();
myCommand.ExecuteScalar();
myConnection.Close();
Before you criticize a man, walk a mile in his shoes. That way, when you do criticize him, you'll be a mile away and have his shoes.
|
|
|
|