|
Thank you.
Ahmet Orkun GEDiK
|
|
|
|
|
Hi all, I need a second opinion on this. Recently I've been struggling with trying to load user controls dynamically. Simple right. Well not if those user controls also host other user controls that are loaded dynamically. It's technically possible but all solutions I've seen so far haven't worked and they have been hacks. The main problem with loading user controls dynamically is keeping track of view state and wiring up events.
Now, one workaround I thought of was loading all the user controls at compile time (so that they are actually part of the page) and hiding/showing the desired controls depending on user input. I had thought that the resultant html source produced would end up becoming bloated with hidden controls. A quick test however, showed that the source ends up excluding all invisible controls, ie they are simply not rendered. So the resultant page is NOT bloated.
To prevent too much work being done on the server however, I thought you could test to see if the control was visible in which case you could safely call your data binding code for example, and if not, you simply do nothing when the control loads.
Well, what do you guys think? Is this how you do it as well? I'd like to hear pros and cons.
Regards
Senkwe
Just another wannabe code junky
|
|
|
|
|
Why in the HELL does WebForm designer restructure my nicely formated code in to a bunch of table tags?!?!
Original Code:
<DIV style="WIDTH: 873px; POSITION: relative; HEIGHT: 320px" ms_positioning="GridLayout">
<asp:button id="cmdUpdate" style="Z-INDEX: 101; LEFT: 584px; POSITION: absolute; TOP: 264px" tabIndex="10" runat="server" Width="80px" Height="24px" Text="Update"></asp:button>
<asp:label id="Label8" style="Z-INDEX: 102; LEFT: 400px; POSITION: absolute; TOP: 16px" runat="server" Width="136px">Welcome Message:</asp:label>
etc...
After changing just ONE item in the designer:
<DIV ms_positioning="GridLayout">
<TABLE height="320" cellSpacing="0" cellPadding="0" width="873" border="0" ms_2d_layout="TRUE">
<TR vAlign="top">
<TD width="0" height="1"></TD>
<TD width="8"></TD>
<TD width="8"></TD>
<TD width="168"></TD>
<TD width="88"></TD>
<TD width="16"></TD>
<TD width="112"></TD>
<TD width="184"></TD>
<TD width="88"></TD>
<TD width="201"></TD>
</TR>
<TR vAlign="top">
<TD width="0" height="15"></TD>
<TD colSpan="3" rowSpan="2">
<input id="hdnID" type="hidden" runat="server" NAME="hdnID"></TD>
<TD colSpan="8"></TD>
</TR>
<TR vAlign="top">
<TD width="0" height="24"></TD>
<TD rowSpan="10"></TD>
<TD colSpan="2">
<asp:label id="Label1" runat="server" Width="152px" Height="16px">Client Name:</asp:label></TD>
etc...
This makes no sense to me, and is EXTREMELY frustrating, because when I go back to the designer, everything is completely misplaced.
Thanks in advance for any ideas.
Jamie Nordmeyer
Portland, Oregon, USA
|
|
|
|
|
Hmmm, I've never experienced that.But I always use a simple HtmlTable for layout. If push comes to shove, you can try that instead.
Senkwe
Just another wannabe code junky
|
|
|
|
|
Thanks, Senkwe. Actually, I figured it out last night. Turns out that I'd somehow set my WebForm to target Internet Explorer 3.0 or below, and since those browsers don't support controls being layed on top of one another, it wraps them in table tags. None of my controls were overlapping, so I guess the designer was just playing it safe.
Jamie Nordmeyer
Portland, Oregon, USA
|
|
|
|
|
I want to display a value as hours which is stored as seconds in a database so I need to convert the value when I bind it to a textbox control. Something like this:
<asp:textbox id="hours" size="3" text='<%# DataBinder.Eval(Container.DataItem, "interval") / 3600 %>' runat="server" />
On the submit side it's easy enough to convert it back to seconds but I'm not sure how to convert it on the aspx side. I can probably change the sql statement but I would like to avoid that. I would also like to avoid having to do the conversion in the page_load function. Can this be done?
Todd Smith
|
|
|
|
|
The method I've used for this type of problem is to create a public method that formats the required output
<asp:textbox id="hours" size="3" text='<%# MyFunction(DataBinder.Eval(Container.DataItem, "interval", "{0}") )%>' runat="server" />
public string MyFunction(string strSeconds)
{
return int.Parse(strSeconds) / 3600;
}
|
|
|
|
|
That works. thx.
<asp:textbox id="hours" size="3" text='<%# Utils.SecsToHours(DataBinder.Eval(Container.DataItem, "hours").ToString()) %>' runat="server" />
public static string SecsToHours(string seconds)
{
try
{
int secs = Int32.Parse(seconds);
int hours = secs / 3600;
return hours.ToString();
}
catch
{
return "";
}
}
Todd Smith
|
|
|
|
|
HI,
IIS is being a twat. It won't let users download .exes from my web site. They user gets a 404 when the input the URL when I know for a fact that the files are there. Could it be some sort of security 'feature' that is causing this? I have run the IIS lockdown tool in the past - is it possible that this has affected it?
By the way, HTML, ASP, JPG, GIF all work fine.
Cheers
|
|
|
|
|
For anyone that cares, I think this is due to IIS lockdown as it restricts the downloading fo some filetypes. I'l know better when I get home tonight and try it out.
|
|
|
|
|
Try setting the Application Settings (Home Directory) the Execute Permissions on None (or Scripts only).
Next check HTTP Headers, File Types for the Registered file type .exe (this must be application/octet-stream).
Succes!
|
|
|
|
|
Thanks for the response but it was the URLScan component of IIS Lockdown wheich was restricting the downloading of exes. God know why
|
|
|
|
|
URLScan blocks exes because they might run on the server, depending on the configuration. You can comment out the exe extension in the DenyExtensions section of the urlscan.ini file [%systemroot%\system32\inetsrv\urlscan\urlscan.ini ], or create an asp page to handle the request and Response.BinaryWrite the file.
|
|
|
|
|
Hi All
I have a data populated in HTML table (3 columns, mutiplerows), I have a text box in the col1,row1. when I press Tab button the focus goes to col2,row1 then col3,row1...what I need is how to make the tabing goes from col1,row1 to col1,row2???????
Thanks in advance
|
|
|
|
|
If you set the tabindex property of the text boxes you can control the tab flow.
|
|
|
|
|
Is there a way to import Excel-files with ASP and can you put the data into a database (like MsSQL)
Thanks!!!
Morten
|
|
|
|
|
Yes, you can use ADO to read from the Excel file, or just the Excel COM objects if it is installed.
--
David Wengier
Sonork ID: 100.14177 - Ch00k
|
|
|
|
|
Hi,
Here's what I'm trying to do:
I have a local application which stores data (locally) in an access or SQLServer database. What I need to do is pass a subset of that data to a remote database on the internet. There are a couple of provisos though - can only use c++/WIN32 on the client (no MFC or .Net), can use any damn technology on the server.
Here are a few methods I have considered:-
1) Convert to XML locally, upload to server using FTP, parse using XML control from ASP page and write into DB. (bit cludgy)
2) Convert to XML string , write to ASP page as HTTP POST and parse in ASP page.
3) Use some crazy new .NET technology (on the server only) to accomplish this for me?
The amount of data transmitted is likely to be pretty small (~10K).
Anybody have any thoughts/suggestions??
Cheers
|
|
|
|
|
Use SQLXML on the server.
|
|
|
|
|
Does this allow you to insert into the remote DB. I've had a quick look on MSDN and it looks like it can be used to query remote data sources but I need to insert. I also need the client to work without any special software (like SOAP or .NET).
Can you point me at any links or other info?
Cheers
|
|
|
|
|
Not sure if this will help you but it could be a start
|
|
|
|
|
James Spibey wrote:
I have a local application which stores data (locally) in an access or SQLServer database.
Which one? If you have SQL Server as your source you could create a DTS package to grab information and push it out to another source.
Nick Parker
|
|
|
|
|
How do you create page templates? Do you use the old fashioned #include to bring in headers and footers, or create user controls that contain aggregated user controls and HTML for your headers and footers, or do you rely on CodeBehind and inject headers/footers before/after the Rendering?
cheers,
Chris Maunder
VC++ - the language that doesn't say 'no'
|
|
|
|
|
I've used the user control method.
|
|
|
|
|
That's a really good question. I have just started building my own site and have designed a quite pretty default.aspx with three web controls (header, footer, and navigator), all arranged with tables. Now I am confronted with the same problem. How to keep all pages consistent? I thought of using plain vanilla #include s, but still didn't come to a decision
Regards
Thomas
Sonork id: 100.10453 Thömmi
Disclaimer: Because of heavy processing requirements, we are currently using some of your unused brain capacity for backup processing. Please ignore any hallucinations, voices or unusual dreams you may experience. Please avoid concentration-intensive tasks until further notice. Thank you.
|
|
|
|