נושאים פעיליםנושאים פעילים  הצגת רשימה של חברי הפורוםרשימת משתמשים  חיפוש בפורוםחיפוש  עזרהעזרה
  הרשמההרשמה  התחברותהתחברות RSS עדכונים
בניית אתרים
RSS UnderWarrior Forums : RSS בניית אתרים
נושא

נושא: RadioButtonList

שליחת תגובהשליחת נושא חדש
כותב
הודעה << נושא קודם | נושא הבא >>
q8z
אורח
אורח


הצטרף / הצטרפה: 01 October 2003
משתמש: אונליין
הודעות: 12647
נשלח בתאריך: 19 June 2005 בשעה 15:27 | IP רשוּם
ציטוט q8z

hi
i search msdn and in google
and work 7 days on this and did not find answer
and after all...i get bug when i try to set text in the label
thanks
this is my code :
קוד:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
 
namespace Idea
{
 public class buy : System.Web.UI.Page
 {
  //private int index;
  protected System.Data.DataSet ds;
  protected System.Data.OleDb.OleDbDataAdapter com;
  protected System.Data.OleDb.OleDbConnection con;
  protected System.Data.OleDb.OleDbDataAdapter UpdateCom;
  public bool IsOpen;
  public string location;
  protected System.Web.UI.WebControls.DropDownList DropDownList1;
  protected System.Web.UI.WebControls.Button Button1;
  protected System.Web.UI.WebControls.Label LblError;
  protected System.Web.UI.WebControls.Label Lbl1;
  protected System.Web.UI.WebControls.CheckBox cb1;
  protected System.Web.UI.WebControls.Label Lbl2;
  protected System.Web.UI.WebControls.Label Lbl3;
  protected System.Web.UI.WebControls.CheckBox cb2;
  protected System.Web.UI.WebControls.CheckBox cb3;
  protected System.Web.UI.WebControls.Button BtnShowData;
  protected System.Web.UI.WebControls.Label LblItem;
  protected System.Web.UI.WebControls.RadioButtonList rblItem;
  protected System.Web.UI.WebControls.Label Label1;
 
  private void Page_Load(object sender, System.EventArgs e)
  {
   //index=1;
   this.rblItem.Items.Clear();
   setConnection();
  }
 
  #region Web Form Designer generated code
  override protected void OnInit(EventArgs e)
  {
   //
   // CODEGEN: This call is required by the ASP.NET Web Form Designer.
   //
   InitializeComponent();
   base.OnInit(e);
  }
  
  /// <summary>
  /// Required method for Designer support - do not modify
  /// the contents of this method with the code editor.
  /// </summary>
  private void InitializeComponent()
  {   
   this.Button1.Click += new System.EventHandler(this.Button1_Click);
   this.BtnShowData.Click += new System.EventHandler(this.BtnShowData_Click);
   this.Load += new System.EventHandler(this.Page_Load);
 
  }
  #endregion
 
  private void Button1_Click(object sender, System.EventArgs e)
  {
   Label1.Text = DropDownList1.SelectedItem.ToString();
   fillDDLI();
  }
  void setConnection()
  {
   this.location="/../../n/i.mdb";
   con = new   System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OL EDB.4.0;Data source=" + this.location);
  }
 
  void openConnection()
  {
   if (!(this.IsOpen))
   {
    this.con.Open();
    IsOpen = true;
   }
  }
 
  void closeConnection()
  {
   if (this.IsOpen)
   {
    this.con.Close();
    IsOpen = false;
   }
  }
  void fillDDLI() {
   try {
    this.openConnection();
    OleDbDataReader dr;
    OleDbCommand cmd = new OleDbCommand("select item from
    where cat=@cat");
        cmd.Connection = con;
        cmd.Parameters.Add("@cat", this.Label1.Text);
        dr = cmd.ExecuteReader();
        while (dr.Read()) {
         rblItem.Items.Add(dr["item"].ToString());
        } 
        this.closeConnection();
       }
       catch (Exception ex) {
        this.LblError.Text=ex.ToString();
       }
      }
      private void fillLabel(){
       try
       {
        this.openConnection();
        OleDbDataReader dr;
        OleDbCommand cmd = new OleDbCommand("select * from [product] where item=@item");
        cmd.Connection = con;
        cmd.Parameters.Add("@item", this.rblItem.SelectedItem.ToString());
        this.LblError.Text=this.rblItem.Sele ctedItem.ToString();
        dr = cmd.ExecuteReader();
        while (dr.Read())
        {
         this.Lbl1.Text =  "name: "+dr["item"].ToString()+" price: "+dr["price"].ToString()+" salePrice: "+dr["salePrice"].ToString();
        } 
        this.closeConnection();
       }
       catch (Exception ex)
       {
        this.LblError.Text=ex.ToString();
       }
      }
      private void BtnShowData_Click(object sender, System.EventArgs e)
      {
        try {
         this.Lbl1.Text=rblItem.Selecte dItem.Text;
        }
        catch (Exception ex) {
         this.LblError.Text=ex.ToString ();
        }
      }
     }
    }

חזרה לתחילת העמוד הצג את כרטיס החבר של q8z חפש הודעות אחרות של q8z בקר בדף הבית של q8z
 
ניר
מנהל האתר
מנהל האתר
סמל אישי

הצטרף / הצטרפה: 12 January 2005
מדינה: Israel
משתמש: מנותק/ת
הודעות: 3296
נשלח בתאריך: 21 June 2005 בשעה 03:09 | IP רשוּם
ציטוט ניר

איפה בדיוק הבאג? סמן את השורה...

__________________
מספר האייסיקיו שלי ו/או כתובת ה-MSN שלי אינם מהווים מוקד תמיכה
חזרה לתחילת העמוד הצג את כרטיס החבר של ניר חפש הודעות אחרות של ניר בקר בדף הבית של ניר
 

אם ברצונך להגיב לנושא זה עליך קודם להתחבר
אם אינך רשום/ה כבר עליך להרשם

  שליחת תגובהשליחת נושא חדש
גרסת הדפסה גרסת הדפסה

קפיצה לפורום
אינך יכול/ה לשלוח נושאים חדשים בפורום זה
אינך יכול/ה להגיב לנושאים בפורום זה
אינך יכול/ה למחוק את הודעותיך ותגוביך בפורום זה
אינך יכול/ה לערוך את הודעותיך ותגובותיך בפורום זה
אינך יכול/ה לצור סקרים בפורום זה
אינך יכול/ה להצביע בסקרים בפורום זה