Showing posts with label converted. Show all posts
Showing posts with label converted. Show all posts

Saturday, March 31, 2012

the best way display data from dropdownlist?

OK..i have a field called - areaID,

i would like to make it to display areaNAME instead of ID, so a human can understand.

What i have done:

1. Converted that field into template;

2. For Edit mode - i made drop down list where a user can choose areaName instead of areaID, though areaID is bounded to the field.

3. For Item mode - ? my question:

i don't want to make the same dropdown list display, it looks not appropriate, - i would like to have 'label' like component to display my areaName on areaID field, how to do it?

I could probably create some function or stored procedure to return areaName, and as a parameter use areaID, but i don't want to complecate matters too much...

I know it had been done 100 times...but not by me...

anyone can give a hint?

thanks for your help!!

I'm not sure why you wouldn't just return the areaname in the query/sp that fills the grid, and use a Label or Literal in your ItemTemplate. After all, the value for that row doesn't really come from the dropdownlist; it comes from the datasource for the parent control.


Hi Peter, I think I have the same issue in that I would like to display descriptive names for domain data in the ItemTemplate, but in order to bind a dropdown in the EditTempate I also need the ID field. Are you suggesting having both the IDand description fields available in the datasource and then binding ItemTemplate label to the description field and the EditTemplate dropdown to the ID field? Sorry if I'm slow, I'm new to .NET in general


Thanks,

- Ben


I am not sure you are asking the right question, because it sounds like you are using a GridView, or other data control. But dropdowns have two properties, DataTextField and dataValueField where you set the field names to display in a drop-down.

That's not what I'm getting at; In a FormView I would like to show a label control in the "view" mode (ItemTemplate) and switch to a dropdown control in the "edit" mode (EditTemplate). My data table currently stores only the ID/foreign key of the domain table as it has been normalized. Now, this arrangement works perfectly with the dropdown as it is populated with the domain dataset and then it's selected row is bound to the ID field in my formview's dataset. Fine.

But in "view" mode I want to add alabel control that shows the user-friendly descriptive text from the domain table instead of a cryptic ID. As stated by the original poster, I could always write a function to "lookup" the domain description using the ID as a key but I'm thinking that's not the in the spirit of the declarative syntax and it's not efficient.

What I think was proposed was to join to the domain table in my source query and get the domain description and have it available along with the ID so I can bind to either one as needed. Was that the idea?


Yes, that's it. Just join on the ID field and pull the name as part of your datasource.


Thanks!

Saturday, March 24, 2012

The element 'compilation' has invalid child element 'compilers'.

I have a number of web projects converted from 1.1 to 2.0 in VS2005.
I am methodically seeing the error below:
The element 'compilation' has invalid child element 'compilers'. List of
possible elements expected: 'assemblies, buildProviders, codeSubDirectories,
expressionBuilders'.
Here's what the web config looks like. The error doesn't cause any issues
and according to the MSDN documentation this is valid. So why is VS2005
giving me this bogus error?
<configuration>
<system.web>
<httpRuntime maxRequestLength="8192"/>
<!-- DYNAMIC DEBUG COMPILATION
Set compilation debug="true" to insert debugging symbols (.pdb
information)
into the compiled page. Because this creates a larger file that
executes
more slowly, you should set this value to true only when debugging
and to
false at all other times. For more information, refer to the
documentation about
debugging ASP.NET files.
-->
<compilation defaultLanguage="vb" debug="true" batch="false">
<compilers>
<compiler language="vb" type="Microsoft.VisualBasic.VBCodeProvider,
System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"
extension=".VB" compilerOptions="/define:Debug=True /define:Trace=True
/imports:Microsoft.VisualBasic,System,System.Collections,System.Configuratio
n,System.Data,System.Drawing,System.Web,System.Web.UI,System.Web.UI.HtmlCont
rols,System.Web.UI.WebControls"/></compilers>
<assemblies>
etc, etc,In 2.0, the <compilers> section is found in machine.config,
so you don't need to place it in web.config.
Check out machine.config.comments in the .Net Framework\config dir.
The syntax has changed.
It's now in the <system.codedom> section.
See : http://msdn2.microsoft.com/en-us/library/e4hwk57e.aspx
Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
ASPNETFAQ.COM : http://www.aspnetfaq.com/
Foros de ASP.NET en Espaol : http://asp.net.do/foros/
======================================
"Robert" <robertv@.noemail.nospam> wrote in message
news:9999C8CB-CF4F-4F1A-89A5-775753A7B124@.microsoft.com...
>I have a number of web projects converted from 1.1 to 2.0 in VS2005.
> I am methodically seeing the error below:
> The element 'compilation' has invalid child element 'compilers'. List of
> possible elements expected: 'assemblies, buildProviders, codeSubDirectorie
s,
> expressionBuilders'.
> Here's what the web config looks like. The error doesn't cause any issues
> and according to the MSDN documentation this is valid. So why is VS2005
> giving me this bogus error?
> <configuration>
> <system.web>
> <httpRuntime maxRequestLength="8192"/>
> <!-- DYNAMIC DEBUG COMPILATION
> Set compilation debug="true" to insert debugging symbols (.pdb
> information)
> into the compiled page. Because this creates a larger file that
> executes
> more slowly, you should set this value to true only when debuggin
g
> and to
> false at all other times. For more information, refer to the
> documentation about
> debugging ASP.NET files.
> -->
> <compilation defaultLanguage="vb" debug="true" batch="false">
> <compilers>
> <compiler language="vb" type="Microsoft.VisualBasic.VBCodeProvider,
> System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"
> extension=".VB" compilerOptions="/define:Debug=True /define:Trace=True
> /imports:Microsoft.VisualBasic,System,System.Collections,System.Configurat
ion,System.Data,System.Drawing,System.Web,System.Web.UI,System.Web.UI.HtmlCo
ntrols,System.Web.UI.WebControls"/></compilers>
> <assemblies>
> etc, etc,
>

The element compilation has invalid child element compilers.

I have a number of web projects converted from 1.1 to 2.0 in VS2005.

I am methodically seeing the error below:

The element 'compilation' has invalid child element 'compilers'. List of
possible elements expected: 'assemblies, buildProviders, codeSubDirectories,
expressionBuilders'.

Here's what the web config looks like. The error doesn't cause any issues
and according to the MSDN documentation this is valid. So why is VS2005
giving me this bogus error?

<configuration>
<system.web>
<httpRuntime maxRequestLength="8192"/>
<!-- DYNAMIC DEBUG COMPILATION
Set compilation debug="true" to insert debugging symbols (.pdb
information)
into the compiled page. Because this creates a larger file that
executes
more slowly, you should set this value to true only when debugging
and to
false at all other times. For more information, refer to the
documentation about
debugging ASP.NET files.
-->
<compilation defaultLanguage="vb" debug="true" batch="false">
<compilers>
<compiler language="vb" type="Microsoft.VisualBasic.VBCodeProvider,
System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"
extension=".VB" compilerOptions="/define:Debug=True /define:Trace=True
/imports:Microsoft.VisualBasic,System,System.Collec tions,System.Configuration,System.Data,System.Draw ing,System.Web,System.Web.UI,System.Web.UI.HtmlCon trols,System.Web.UI.WebControls"/></compilers>
<assemblies
etc, etc,In 2.0, the <compilers> section is found in machine.config,
so you don't need to place it in web.config.

Check out machine.config.comments in the .Net Framework\config dir.

The syntax has changed.
It's now in the <system.codedom> section.

See : http://msdn2.microsoft.com/en-us/library/e4hwk57e.aspx

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
ASPNETFAQ.COM : http://www.aspnetfaq.com/
Foros de ASP.NET en Espaol : http://asp.net.do/foros/
======================================
"Robert" <robertv@.noemail.nospam> wrote in message
news:9999C8CB-CF4F-4F1A-89A5-775753A7B124@.microsoft.com...
>I have a number of web projects converted from 1.1 to 2.0 in VS2005.
> I am methodically seeing the error below:
> The element 'compilation' has invalid child element 'compilers'. List of
> possible elements expected: 'assemblies, buildProviders, codeSubDirectories,
> expressionBuilders'.
> Here's what the web config looks like. The error doesn't cause any issues
> and according to the MSDN documentation this is valid. So why is VS2005
> giving me this bogus error?
> <configuration>
> <system.web>
> <httpRuntime maxRequestLength="8192"/>
> <!-- DYNAMIC DEBUG COMPILATION
> Set compilation debug="true" to insert debugging symbols (.pdb
> information)
> into the compiled page. Because this creates a larger file that
> executes
> more slowly, you should set this value to true only when debugging
> and to
> false at all other times. For more information, refer to the
> documentation about
> debugging ASP.NET files.
> -->
> <compilation defaultLanguage="vb" debug="true" batch="false">
> <compilers>
> <compiler language="vb" type="Microsoft.VisualBasic.VBCodeProvider,
> System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"
> extension=".VB" compilerOptions="/define:Debug=True /define:Trace=True
> /imports:Microsoft.VisualBasic,System,System.Collec tions,System.Configuration,System.Data,System.Draw ing,System.Web,System.Web.UI,System.Web.UI.HtmlCon trols,System.Web.UI.WebControls"/></compilers>
> <assemblies>
> etc, etc,
Thanks for the response.

I removed it entirely from web.config as it is apparently unnecessary.

Guess I wish the migration wizard could of either 1) removed it for me or 2)
flagged it as a todo with an explanation.

Thx.
R-

"Juan T. Llibre" wrote:

> In 2.0, the <compilers> section is found in machine.config,
> so you don't need to place it in web.config.
> Check out machine.config.comments in the .Net Framework\config dir.
> The syntax has changed.
> It's now in the <system.codedom> section.
> See : http://msdn2.microsoft.com/en-us/library/e4hwk57e.aspx
>
>
> Juan T. Llibre, ASP.NET MVP
> ASP.NET FAQ : http://asp.net.do/faq/
> ASPNETFAQ.COM : http://www.aspnetfaq.com/
> Foros de ASP.NET en Espa?ol : http://asp.net.do/foros/
> ======================================
> "Robert" <robertv@.noemail.nospam> wrote in message
> news:9999C8CB-CF4F-4F1A-89A5-775753A7B124@.microsoft.com...
> >I have a number of web projects converted from 1.1 to 2.0 in VS2005.
> > I am methodically seeing the error below:
> > The element 'compilation' has invalid child element 'compilers'. List of
> > possible elements expected: 'assemblies, buildProviders, codeSubDirectories,
> > expressionBuilders'.
> > Here's what the web config looks like. The error doesn't cause any issues
> > and according to the MSDN documentation this is valid. So why is VS2005
> > giving me this bogus error?
> > <configuration>
> > <system.web>
> > <httpRuntime maxRequestLength="8192"/>
> > <!-- DYNAMIC DEBUG COMPILATION
> > Set compilation debug="true" to insert debugging symbols (.pdb
> > information)
> > into the compiled page. Because this creates a larger file that
> > executes
> > more slowly, you should set this value to true only when debugging
> > and to
> > false at all other times. For more information, refer to the
> > documentation about
> > debugging ASP.NET files.
> > -->
> > <compilation defaultLanguage="vb" debug="true" batch="false">
> > <compilers>
> > <compiler language="vb" type="Microsoft.VisualBasic.VBCodeProvider,
> > System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"
> > extension=".VB" compilerOptions="/define:Debug=True /define:Trace=True
> > /imports:Microsoft.VisualBasic,System,System.Collec tions,System.Configuration,System.Data,System.Draw ing,System.Web,System.Web.UI,System.Web.UI.HtmlCon trols,System.Web.UI.WebControls"/></compilers>
> > <assemblies>
> > etc, etc,
>
Hi Robert,

Yes, what a pity that the migration wizard was not able to automatically
correct this, maybe it is due to the <system.codedom> is outside the
<system.web> that beyond the migration checking. Anyway, the error message
make some sense, also thanks for Juan's informative suggestion.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

-------
| Thread-Topic: The element 'compilation' has invalid child element
'compilers
| thread-index: AcXpe7dhGIAffoz4SzOtjdSjQDOyUA==
| X-WBNR-Posting-Host: 67.180.214.235
| From: =?Utf-8?B?Um9iZXJ0?= <robertv@.noemail.nospam>
| References: <9999C8CB-CF4F-4F1A-89A5-775753A7B124@.microsoft.com>
<ewe5xmX6FHA.3924@.TK2MSFTNGP10.phx.gbl>
| Subject: Re: The element 'compilation' has invalid child element
'compilers
| Date: Mon, 14 Nov 2005 16:30:01 -0800
| Lines: 72
| Message-ID: <0A4CC52E-0180-414A-9D4D-DAF5F94820F1@.microsoft.com>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 8bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGXA03.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:358118
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Thanks for the response.
|
| I removed it entirely from web.config as it is apparently unnecessary.
|
| Guess I wish the migration wizard could of either 1) removed it for me or
2)
| flagged it as a todo with an explanation.
|
| Thx.
| R-
|
| "Juan T. Llibre" wrote:
|
| > In 2.0, the <compilers> section is found in machine.config,
| > so you don't need to place it in web.config.
| >
| > Check out machine.config.comments in the .Net Framework\config dir.
| >
| > The syntax has changed.
| > It's now in the <system.codedom> section.
| >
| > See : http://msdn2.microsoft.com/en-us/library/e4hwk57e.aspx
| >
| >
| >
| >
| > Juan T. Llibre, ASP.NET MVP
| > ASP.NET FAQ : http://asp.net.do/faq/
| > ASPNETFAQ.COM : http://www.aspnetfaq.com/
| > Foros de ASP.NET en Espa?ol : http://asp.net.do/foros/
| > ======================================
| > "Robert" <robertv@.noemail.nospam> wrote in message
| > news:9999C8CB-CF4F-4F1A-89A5-775753A7B124@.microsoft.com...
| > >I have a number of web projects converted from 1.1 to 2.0 in VS2005.
| | > > I am methodically seeing the error below:
| | > > The element 'compilation' has invalid child element 'compilers'.
List of
| > > possible elements expected: 'assemblies, buildProviders,
codeSubDirectories,
| > > expressionBuilders'.
| | > > Here's what the web config looks like. The error doesn't cause any
issues
| > > and according to the MSDN documentation this is valid. So why is
VS2005
| > > giving me this bogus error?
| | > > <configuration>
| > > <system.web>
| > > <httpRuntime maxRequestLength="8192"/>
| > > <!-- DYNAMIC DEBUG COMPILATION
| > > Set compilation debug="true" to insert debugging symbols
(.pdb
| > > information)
| > > into the compiled page. Because this creates a larger file
that
| > > executes
| > > more slowly, you should set this value to true only when
debugging
| > > and to
| > > false at all other times. For more information, refer to the
| > > documentation about
| > > debugging ASP.NET files.
| > > -->
| > > <compilation defaultLanguage="vb" debug="true" batch="false">
| > > <compilers>
| > > <compiler language="vb" type="Microsoft.VisualBasic.VBCodeProvider,
| > > System, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=B77A5C561934E089"
| > > extension=".VB" compilerOptions="/define:Debug=True /define:Trace=True
| /imports:Microsoft.VisualBasic,System,System.Collec tions,System.Configuratio
n,System.Data,System.Drawing,System.Web,System.Web .UI,System.Web.UI.HtmlCont
rols,System.Web.UI.WebControls"/></compilers>
| > > <assemblies>
| | > > etc, etc,
| | | >
| >
| >
|