---
title: "Selected Problem"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/86370-selected-problem"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "SteveP"
published: "2003-09-18T16:26:31.000Z"
updated: "2003-09-18T16:41:36.000Z"
replies: 4
views: 159
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/asp/86370-selected-problem"
---

# Selected Problem

## #1 — SteveP, 2003-09-18T16:26Z

```
Response.Write("<option Value=""" & trim(ObjRs("Description")))
 
	If Trim(VarDepartment) = Trim(ObjRs("Description")) then
	Response.Write (" Selected")
	end if

	Response.write (""">") 
	Response.Write(ObjRs("Description") & "</option>") & VbCrlf
```

Detta generar följande

```
<select class="selectflex1" name="frmDepartment">
<option Value="Finance">Finance</option>
<option Value="General Insurance Selected">General Insurance</option>
<option Value="Human Resources">Human Resources</option>
<option Value="Investment">Investment</option>
</select>

Som ni ser så hamnar "Selected" innanför fnuttarna.
[kod]<option Value="General Insurance Selected">
```

Men jag måste ha dubbelfnuttar runt strängarna annars bryter den av efter ett mellanslag.

Hur ska ja göra så det blir 

```
<option Value="General Insurance" Selected>General Insurance</option>
```

Permalänk: https://www.webforum.nu/p/86370

## #2 — SteveP, 2003-09-18T16:28Z

Var ju iofs inte så klurigt.. 

```
Response.Write("<option Value=""" & trim(ObjRs("Description")))
 
	If Trim(VarDepartment) = Trim(ObjRs("Description")) then
	Response.Write (""" Selected")
	end if

	Response.write (">") 
	Response.Write(ObjRs("Description") & "</option>") & VbCrlf
```

Permalänk: https://www.webforum.nu/p/1161991

## #3 — SteveP, 2003-09-18T16:32Z

Detta blev ju iofs ändå fel :(

Nu blev det

```

<option Value="Administration>Administration</option>
<option Value="Finance>Finance</option>
<option Value="General Insurance" Selected>General Insurance</option>
<option Value="Human Resources>Human Resources</option>
<option Value="Investment>Investment</option>
```

Alltså ingen avslutande fnutt på dom andra.

Permalänk: https://www.webforum.nu/p/1161996

## #4 — LarsG, 2003-09-18T16:38Z

```
Response.Write "<option Value=""" & trim(ObjRs("Description"))  & """"
 
If Trim(VarDepartment) = Trim(ObjRs("Description")) then
	Response.Write " Selected"
end if

Response.write ">"
Response.Write ObjRs("Description") & "</option>" & VbCrlf
```

Permalänk: https://www.webforum.nu/p/1162000

## #5 — SteveP, 2003-09-18T16:41Z

Ah tack! :)

Permalänk: https://www.webforum.nu/p/1162001

---

Tråden på webben: https://www.webforum.nu/amne/asp/86370-selected-problem
