|
I have a server control that I have made. In it I am making use some strongly typed List properties tagged with [PersistenceMode(PersistenceMode.InnerProperty)]. The idea being that I can markup in my consuming page like
<cc2:GenericForm ID="GenericForm1 runat="server" ...>
<EmailRecipients>
<cc2:Emailrecipient Address="someone@somewhere.com" />
<cc2:Emailrecipient Address="someelse@somewhere.com" />
...
</EmailRecipients>
</cc2:GenericForm>
This works fine, in the sense that intelisense works perfectly and I am able to use the values and render my control perfectly at run time. However, if I look at the design surface I don't see my control as its supposed to be rendered. I see a gray box with a red error message that reads
"Error Creating Control - GenericForm1 'cc2:GenericForm' could bot be set on property 'EmailRecipients'."
How can I avoid this error box? I don't even really care if the control renders out fully or if it just renders a blank little gray box that says "GenericForm1" or something like that. I setup a designer class for this control, and overrode the GetErrorDesignTimeHtml method, but Visual Studio doesn't use it. I am not certian what is the pertinent code so here is a bit of it
Here is the property in my control class
private List<EmailRecipient> _EmailRecipients;
[PersistenceMode(PersistenceMode.InnerProperty)]
public List<EmailRecipient> EmailRecipients
{
get
{
if (_EmailRecipients == null)
_EmailRecipients = new List<EmailRecipient>();
return _EmailRecipients;
}
set { _EmailRecipients = value; }
}
And here is the EmailRecipient class itself.
public class EmailRecipient
{
private string _Address;
public string Address
{
get { return _Address; }
set { _Address = value; }
}
}
Thanks for your help.
|
|
|
|
|
hi,
can anyone tell me which site is good to refere(other than microsoft & codeproject) for ASP.NET 2.0 new controls like gridview,linkedlist, etc.,
i need some samples on this controls.
Thanks,
Rahi
If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
www.asp.net[^]
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
thanks alot. really very good site. now i am watching the vedios on .NET 2.0.
thanks,
Rahi
If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Well there are many sites:
http://www.gridviewguy.com/Articles.aspx
www.w3school.com
and many others....
|
|
|
|
|
Thanks alot
rahi
If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Hello,
I have an ASPX file with this.
Default.aspx:
<asp:SqlDataSource ... >
<SelectParameters>
<asp:QueryStringParameter DefaultValue="<font color=FF0000>25</font>" Name="PageSize" QueryStringField="PageSize" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource> But I would like to replace it with something like this.
Default.aspx:
<asp:SqlDataSource ... >
<SelectParameters>
<asp:QueryStringParameter DefaultValue="<font color=FF0000><%= PageSize %></font>" Name="PageSize" QueryStringField="PageSize" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource> Default.aspx.cs:
public partial class Default : System.Web.UI.Page
{
public Int32 <font color=FF0000>PageSize = 25</font>;
...
} The key point being, that I want to use a variable (PageSize) from the code behind class as a parameter to the SqlDataSource control. But it doesn't work. Does anyone know what I'm doing wrong?
Thanks for any help!
|
|
|
|
|
You can't put a script tag inside a server control.
Put an ID on the control, and set the property of the control from code behind:
<asp:QueryStringParameter ID="PageSize" Name="PageSize" QueryStringField="PageSize" Type="Int32" /><br />
<br />
PageSize.DefaultValue = 25;
---
Year happy = new Year(2007);
|
|
|
|
|
Thanks, but I get this error message:
Parser Error Message: Type 'System.Web.UI.WebControls.QueryStringParameter' does not have a public property named 'ID'.
|
|
|
|
|
Should be <asp:QueryStringParameter ID="PageSize" Name="PageSize" QueryStringField="PageSize" Type="Int32" />
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
Thanks, because of your help I figured that I can do something like this in code behind:
SqlDataSource1.SelectParameters["PageSize"].DefaultValue = Convert.ToString( PageSize );
|
|
|
|
|
It won't work as a coding expression... but would it work as a databinding expression, using <%# ... %> syntax? Are databinding expressions evaluated in data source controls?
|
|
|
|
|
Hello All,
I'm trying to design a simple web site using a menu control that can
found at:
http://www.destinpipeline.com/default.htm
Is this an older way to do menu controls, and can this easily be done
in ASP.NET 2.0? Please provide any links to examples on how to do
this? If you also notice when you click on Capacity how the title
changes from Informational Postings to Capacity. I also need to figure
out how to do that as well.
Thanks
|
|
|
|
|
|
|
I don't have time to test out my theory, but I'm guessing that to do this in the html you would have to do it like this:
ImageURL=<%=Request.ApplicationPath & "/Images/image_file.gif"%>
Or some variation of this. Hope this helps.
|
|
|
|
|
Hey.
I have a site that allows users to upload images to a web server. I realise this could be very dangerous and so i wish to limit users to uploading jpegs.
The way I have of dealing with this is to read the header of the file - if it is correct then allow the file to stay else delete it. However I am unsure of any more vulnerabilities that may be present.
If any one has any experience in this and would like to offer advise i would be most grateful.
Cheers
Dan
|
|
|
|
|
Are you checking the MIME type? Are you limiting the file extensions to .jpg/.jpeg?
Jon Sagara
I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So i had to leave the place as soon as possible.
--Mr.Prakash
Blog | Site | Articles
|
|
|
|
|
Oh man that is hard. The jpeg format is somewhat flexible - there are vendor specific implementations so it is hard telling whether or not it is valid. Normally, you read the first few bytes and then compare them to specific combinations. If memory serves, the standard is to store the first 4 bytes as ff d8 ff e0.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hey.
Yes i am going to limit the extension to jpg/jpeg. Need to look at the MIME type as I am uncertain to what it is but thanks for bringing that to light.
Regarding the second reply - I chose jpg without much research just because it is a common file type. Is this a bad choice? Should I use a different format?
Cheers
Dan
|
|
|
|
|
Google Blogger prefers PNG. Even when we upload a GIF, it converts to PNG, if I am right. Is'nt it?
|
|
|
|
|
Am young user of asp.net.
I need medium and advance trainer, preferaly visual on ASP.NET
Thank you
|
|
|
|
|
Are you asking for someone to tutor you? Go to the job boards.
only two letters away from being an asset
|
|
|
|
|
hi dear
i am working on .net(1.1) web service and due to delay in response i made it multi threaded
but when i passed a object in function which is called on a new thread, it is throwing ObjectNullReference exception...
because it is unable to get value from the property of that object....
but by looking in quickwatch the state of object where it is throwing that exception
all the private member of object are having there values but in value column of quickwatch window
it is showing "error : cannot obtain value" against each and every public member.
i am giving you the source code how i am doing multi threading...
public class Threading
{
Testing testing = new Testing(PassedObject obj);
ThreadStart threadStart=new ThreadStart(testing.PerFormSomeAction);
Thread thread=new Thread(threadStart);
thread.Start();
}
public class Testing
{
private PassedObject _obj;
public void testing(PassedObject obj_)
{
this._obj=obj_;
}
public void PerformSomeAction()
{
// code here
// it is showing error here while accessing some of the property of _obj.
// but by using quickwatch it is showing value of private member's and displaying "error:cannot obtain value" for public members..
}
}
please help in the matter..
a kind reply is awaited
reply to : vishalsharma808@hotmail.com
vishalsharma556@yahoo.co.in
regards
vishal
Thanks & Regards
Vishal Sharma
vishalsharma556@yahoo.co.in
|
|
|
|
|
You have to show some code that is actually possible to run, in order for someone to be able to say what's wrong with it.
The code that you have shown won't even compile, as the constructor you try to use to create an instance of the Testing class does not exist.
---
Year happy = new Year(2007);
|
|
|
|