Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,038

HOME > .NET Framework > Forum > ขอความช่วยเหลือค่ะ นะคะๆ (ขออภัยที่ไม่ได้ชี้แจ้งหัวข้อชัดๆ เพราะไม่รู้จะตั้งหัวข้อว่าอะไรดี >/\< )


 

[.NET] ขอความช่วยเหลือค่ะ นะคะๆ (ขออภัยที่ไม่ได้ชี้แจ้งหัวข้อชัดๆ เพราะไม่รู้จะตั้งหัวข้อว่าอะไรดี >/\< )

 
Topic : 044630



โพสกระทู้ ( 94 )
บทความ ( 0 )



สถานะออฟไลน์
Twitter


(ขออภัยที่ไม่ได้ชี้แจ้งหัวข้อชัดๆ เพราะไม่รู้จะตั้งหัวข้อว่าอะไรดี >/\< )

คือว่า...

สมมุติมี RadioButtonList อยู่ปุ่มนึง ตอนที่ยังไม่ได้เลือก TextBox อันข้างๆ ก็มีค่า Enabled = False
แต่ว่าถ้าเลือกแล้ว TextBox อันข้างๆ อันนั้น ก็จะมีค่า Enabled = True ทันที โดยไม่ต้องกด Submit
ไม่ทราบว่าทำได้หรือเปล่าคะ??? แล้วใช้คำสั่งอะไรหรอคะ?? คือลอง if แล้ว แต่ก็ไม่ได้ผลอ่าคะ


ไม่รู้ว่างงกันหรือเปล่า แต่ก็ขอความเมตตาด้วยนะคะ ^^"



Tag : - - - -

Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2010-06-28 17:21:24 By : akura View : 1290 Reply : 6
 

 

No. 1



โพสกระทู้ ( 145 )
บทความ ( 0 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์


ใช้ event ของตัว radio สิครับ

Code (VB.NET)
1.Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
2.        TextBox1.Enabled = True
3.    End Sub

Date : 2010-06-28 17:35:08 By : noptalent
 

 

No. 2



โพสกระทู้ ( 1,603 )
บทความ ( 1 )



สถานะออฟไลน์


ASP.NET ปะคะ

สมมุติมี RadioButtonList อยู่ปุ่มนึง ตอนที่ยังไม่ได้เลือก TextBox อันข้างๆ ก็มีค่า Enabled = False
RadioButtonList หรือ RadioButton เจ๋ยๆ


แต่ว่าถ้าเลือกแล้ว TextBox อันข้างๆ อันนั้น ???
เลือก texbox คือยังไงคะ key ค่าลงไปหรอ หรือว่า mouseclick ????

แล้วถ้า CLICK RadioButtonList หรือ RadioButton ล่ะจะเกิดอะไรขึ้นคะ

ไหนขอดู SCREEN CAP ที่ออกแบบดิคะ
Date : 2010-06-28 18:24:46 By : blurEyes
 

 

No. 3



โพสกระทู้ ( 3,144 )
บทความ ( 1 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์


javascript เลยครับ

aspx
01.<table>
02.    <tr>
03.        <td>
04.            <asp:RadioButtonList ID="RadioButtonList1" runat="server">
05.                <asp:ListItem></asp:ListItem>
06.                <asp:ListItem></asp:ListItem>
07.                <asp:ListItem></asp:ListItem>
08.            </asp:RadioButtonList>
09.        </td>
10.        <td>
11.            <asp:Panel ID="Panel1" runat="server">
12.                <asp:TextBox ID="TextBox1" runat="server" Enabled="false"></asp:TextBox>
13.                <br />
14.                <asp:TextBox ID="TextBox2" runat="server" Enabled="false"></asp:TextBox>
15.                <br />
16.                <asp:TextBox ID="TextBox3" runat="server" Enabled="false"></asp:TextBox>
17.            </asp:Panel>
18.        </td>
19.    </tr>
20.</table>

aspx.cs
01.List<TextBox> TextBoxList = new List<TextBox>();
02.TextBoxList.Add(TextBox1);
03.TextBoxList.Add(TextBox2);
04.TextBoxList.Add(TextBox3);
05. 
06.int item = 0;
07.foreach (ListItem radioButton in RadioButtonList1.Items)
08.{
09.    System.Text.StringBuilder Sb = new System.Text.StringBuilder();
10.    Sb.Append("javascript:");
11. 
12.    for (int i = 0; i < TextBoxList.Count; i++)
13.    {
14.        if (item == i)
15.            Sb.AppendFormat("document.getElementById('{0}').disabled=false;", TextBoxList[i].ClientID);
16.        else
17.            Sb.AppendFormat("document.getElementById('{0}').disabled=true;", TextBoxList[i].ClientID);
18.    }
19. 
20.    radioButton.Attributes.Add("onchange", Sb.ToString());
21.    item++;
22.}

Date : 2010-06-28 22:43:49 By : tungman
 

 

No. 4



โพสกระทู้ ( 94 )
บทความ ( 0 )



สถานะออฟไลน์
Twitter

แบบที่ Design ไว้คะ



อย่างที่เห็น ว่า ในรูปแบบการลามี 2 ตัวเลือก (ซึ่งหนูใช้เป็น RadioButtonList คะ)
มีลาเต็มวัน (คู่กับ TextBox ตรงจำนวน วัน) กับ ลาเป็นชั่วโมง (คู่กับ TextBox ตรงจำนวน ชั่วโมง)

หนูอยากให้แบบว่า ถ้ายังไม่ได้เลือกอะไร ให้ Textbox ทั้งสองอัน มีค่า Enabled = False
แต่ถ้ามีการเลือกแล้ว ให้ TextBox อันที่ตรงกับตัวที่ถูกเลือก มีค่า Enabled = True โดยไม่ต้องกดปุ่ม Submit คะ

เช่น
หนูเลือก ลาเต็มวัน ก็ให้ TextBox ที่ตรงกับลาเต็มวัน Enabled = True ทันทีเลย โดยไม่ต้องกด Submit

ทำได้หรือเปล่าคะ?? หรือต้องกด Submit อย่างเดียวถึงทำได้??
Date : 2010-06-29 08:25:57 By : akura
 

 

No. 5



โพสกระทู้ ( 1,603 )
บทความ ( 1 )



สถานะออฟไลน์


cute-header-04x
โทดทีเนทน่าวอะค่ะ เลยไม่ได้เอามาแปะ
ส่วนใหญ่ ก้อคล้ายของพี่ตึ๋ง แต่ประยุกต์ให้เป็น interface ของ คุณ
นี่ค่ะ

javascript with textbox and ra

มี CODE ดังนี้


Code (ASP)

01.<%@ Page Language="VB" AutoEventWireup="false" CodeFile="RadioButtonWithText.aspx.vb"
02.    Inherits="RadioButtonWithText" %>
03. 
04.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
06.<head runat="server">
07.    <title></title>
08.    <style>
09.        body
10.        {
11.            font-family: Tahoma, MS Sans Serif;
12.            font-size: 11px;
13.            color: DarkSlateBlue;
14.        }
15.        .EntryRow
16.        {
17.            background-color: lemonchiffon;
18.            text-align: left;
19.        }
20.    </style>
21.</head>
22.<body>
23.    <form id="form1" runat="server">
24.    <div >
25.        <table border="0" cellpadding="3" cellspacing="0" style=" background-color : WhiteSmoke">
26.            <tr class="EntryRow">
27.                <td colspan="3">
28.                    รายละเอียด
29.                </td>
30.            </tr>
31.            <tr>
32.                <td style="width: 100px; text-align: right;">
33.                    รูปแบบการลา
34.                </td>
35.                <td style="width: 80px">
36.                    <asp:RadioButton ID="RadioButtonDayLeave" runat="server" Text="ลาเต็มวัน" GroupName="TakeLeave" />
37.                </td>
38.                <td >
39.                    <asp:TextBox ID="TextBoxTotalDay" runat="server" Width ="40px"></asp:TextBox> วัน
40.                </td>
41.            </tr>
42.            <tr>
43.                <td style="width: 100px; text-align: right;">
44.                </td>
45.                <td style="width: 80px">
46.                    <asp:RadioButton ID="RadioButtonHourLeave" runat="server" Text="ลาเป็นชม." GroupName="TakeLeave" />
47.                </td>
48.                <td >
49.                    <asp:TextBox ID="TextBoxTotalHour" runat="server" Width ="40px"></asp:TextBox> ชม.
50.                </td>
51.            </tr>
52.        </table>
53.         
54.         
55.    </div>
56.    <script type="text/javascript" language ="javascript" >
57.        
58.        function javascriptCheckedRadioButtonFormTextBox(argTextBox, argRadioButtonName) {           
59.            var myRadioButton = document.getElementById(argRadioButtonName);
60.            if (myRadioButton == null) {
61.                return fasle;
62.            }
63.            myRadioButton.checked = true;
64.            return false;
65.        }
66. 
67.        function javascriptCheckedRadioButtonFormTextBoxWithKeyPress(argTextBox, argRadioButtonName) {
68.            var myRadioButton = document.getElementById(argRadioButtonName);
69.            if (myRadioButton == null) {
70.                return fasle;
71.            }
72.            if (argTextBox.value.length > 0)
73.                myRadioButton.checked = true;
74.            return false;
75.        }
76.         
77.    </script>
78.     
79.     
80.    </form>
81.</body>
82.</html>



Code (VB.NET)
01.Imports System
02.Imports System.Web
03.Imports System.Web.UI
04.Imports System.Web.UI.WebControls
05. 
06.Partial Class RadioButtonWithText
07.    Inherits System.Web.UI.Page
08. 
09.    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
10.        AddJavaScriptTrigger()
11.    End Sub
12. 
13. 
14.    Sub AddJavaScriptTrigger()
15. 
16.        TextBoxTotalDay.Attributes.Add("onclick", "javascriptCheckedRadioButtonFormTextBox (this ,'" + RadioButtonDayLeave.ClientID + "') ;")
17.        TextBoxTotalHour.Attributes.Add("onclick", "javascriptCheckedRadioButtonFormTextBox (this ,'" + RadioButtonHourLeave.ClientID + "') ;")
18. 
19.        TextBoxTotalDay.Attributes.Add("onkeypress", "javascriptCheckedRadioButtonFormTextBoxWithKeyPress (this ,'" + RadioButtonDayLeave.ClientID + "') ;")
20.        TextBoxTotalHour.Attributes.Add("onkeypress", "javascriptCheckedRadioButtonFormTextBoxWithKeyPress (this ,'" + RadioButtonHourLeave.ClientID + "') ;")
21.        TextBoxTotalDay.Attributes.Add("onkeyup", "javascriptCheckedRadioButtonFormTextBoxWithKeyPress (this ,'" + RadioButtonDayLeave.ClientID + "') ;")
22.        TextBoxTotalHour.Attributes.Add("onkeyup", "javascriptCheckedRadioButtonFormTextBoxWithKeyPress (this ,'" + RadioButtonHourLeave.ClientID + "') ;")
23. 
24.    End Sub
25. 
26.End Class

Date : 2010-06-30 07:41:24 By : blurEyes
 

 

No. 6

Guest


ได้แล้วค่ะ ขอบคุณมากค่ะ ^^
Date : 2010-06-30 09:30:48 By : akura
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ขอความช่วยเหลือค่ะ นะคะๆ (ขออภัยที่ไม่ได้ชี้แจ้งหัวข้อชัดๆ เพราะไม่รู้จะตั้งหัวข้อว่าอะไรดี >/\< )
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)





ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2025 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่