.NET Logo
Welcome Guest Search | Active Topics | Members | Log In | Register

จารย์คะ เขียนไม่ถูกค่ะ Options · View
pudjeeb
Posted: Wednesday, January 16, 2008 2:34:25 PM
Rank: มือสมัครเล่น
Groups: Member

Joined: 12/6/2007
Posts: 27

จารย์คะ เขียนไม่ถูกค่ะ

คือหน้า search มี dropdownlist ให้เลือกค่าเงินที่ต้องการค้นหา แต่ก็มี link ตัวค่าเงินส่งมาให้จากหน้าอื่นด้วย

ต้องการเช็คก่อนอ่ะค่ะ ว่าถ้ามี query string ส่งมาก็ให้ dropdown ขึ้นค่าเงินให้เลย ไม่จำเป็นต้องเลือกอีก แต่ถ้าไม่มี querystring ส่งมา ก็ให้ใช้ค่าที่ได้จากการเลือกใน dropdownlist แบบว่า เขียนไม่ถูกค่ะ ไม่รู้จะ else ต่อยังงัยค่ะ

protected void Page_Load(object sender, EventArgs e)
{
    String strCurrency = Server.HtmlEncode(Request.QueryString["Currency"]);
 
    if (strCurrency != "")
    {
        ddlCurrency.SelectedValue = strCurrency;
    }
}

 

pittawati
Posted: Thursday, January 17, 2008 9:46:25 AM

Rank: มือสมัครเล่น
Groups: Member

Joined: 12/2/2007
Posts: 22

pudjeeb wrote:

protected void Page_Load(object sender, EventArgs e)
{
    String strCurrency = Server.HtmlEncode(Request.QueryString["Currency"]);
 
    if (strCurrency != "")//อันนี้เป็นในกรณีที่มีค่า strCurrency อยุ่แล้วจึงไม่ต้องเลือกใน dropdown
    {
        ddlCurrency.SelectedValue = strCurrency;
    }
else // ไม่มีค่า strCurrency ที่ส่งมา ดังนั้นให้ทำการเลือก ค่าเงินจาก dropdown
   {
       strCurrency = ddlCurrency.SelectedValue.ToString();
   }
}
 
ถ้าผมเข้าใจผิดยังไงลองถามเพิ่มเติมนะครับ

 

ball
Posted: Friday, January 18, 2008 2:32:56 AM

Rank: อาจารย์
Groups: Administration

Joined: 12/1/2007
Posts: 473
Location: Bangkok

แก้บรรทัดนี้ครับ

if (strCurrency != "")

เปลี่ยนเป็น

if (strCurrency != null)


Imagination is more Important than Knowledge... /A.Einstein
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

YAFVision Theme Created by Jaben Cargman (Tiny Gecko)
Powered by Yet Another Forum.net version 1.9.1.8 (NET v2.0) - 3/29/2008
Copyright © 2003-2008 Yet Another Forum.net. All rights reserved.


Sponsored by