protected void FormView2_DataBound(object sender, EventArgs e) { if (FormView2.DataItemCount > 0) { int li_r2r; DataRowView rowView = (DataRowView)FormView2.DataItem; string ls_val = rowView["wrsp_uid"].ToString(); li_respNum = Convert.ToInt32(rowView["wrsp_RespNum"]); if (rowView["wrsp_RespToResp"] != DBNull.Value) { li_r2r = Convert.ToInt32(rowView["wrsp_RespToResp"].ToString()); } else { li_r2r = 0; } woUsersBLL userLogic = new woUsersBLL(); ls_val = userLogic.GetFullNameByID(Convert.ToInt32(ls_val)); ((Label)FormView2.FindControl("wrsp_uidLabel")).Text = ls_val; TextBox txtBx = (TextBox)(FormView2.FindControl("txtBxHeader")); if (li_r2r != 0) { txtBx.Text = "Response to Work Order Response # " + li_r2r.ToString(); txtBx.ForeColor = System.Drawing.Color.Red; } else { txtBx.Text = "Response to Work Order # " + Request.QueryString["word_WOnum"].ToString(); } } }
protected void btnNext_Click(object sender, ImageClickEventArgs e) { List <int> list = (List <int>)Session["search"]; HiddenField ID = FormView1.FindControl("ID") as HiddenField; int id = 0; if (int.TryParse(ID.Value, out id)) { int index = list.FindIndex(x => x == id); if (index == list.Count - 1) { index = 0; } else { index = index + 1; } id = list[index]; ArtGalleryDS.PictureDataTable table = PictureDL.GetById(id); FormView1.DataSource = table.Rows; FormView1.DataBind(); ArtGalleryDS.Picture_GetWithWaterMarkDataTable table1 = PictureDL.GetWithWaterMark(id); FormView2.DataSource = table1.Rows; FormView2.DataBind(); up1.Update(); up2.Update(); } }
public void FormView2_InsertItem(Record record) { if (ModelState.IsValid) { try { record.RecordTypeID = 2; Service.SaveRecord(record); var digrecord = new DigitalRecord { RecordID = record.RecordID, DiscSize = ((TextBox)FormView2.FindControl("DiscSizeTextBox")).Text }; Service.SaveDigitalRecord(digrecord); RecordID = record.RecordID; Response.RedirectToRoute("RecordDetails", new { id = digrecord.RecordID }); Context.ApplicationInstance.CompleteRequest(); } catch (Exception) { ModelState.AddModelError(String.Empty, "Ett fel inträffade då skivan skulle sparas"); } } }
private void loadBlogPost() { var blogList = _db.BlogPosts.Where(s => s.Category == 3).OrderByDescending(s => s.PublishedTime).Take(1).ToList(); if (!blogList.Any()) { FormView2.DataSource = new List <BlogPost>(); //FormView2.DataSourceID = string.Empty; FormView2.DataBind(); } FormView2.DataSource = blogList; FormView2.DataBind(); var postId = blogList[0].PostId; Session["PostId"] = postId; var commentList = _db.BlogComments.Where(s => s.PostId == postId).OrderByDescending(m => m.Date).Take(5).ToList(); if (!commentList.Any()) { grdComment.DataSource = new List <BlogPost>(); grdComment.DataBind(); } grdComment.DataSource = commentList; grdComment.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (HttpContext.Current.Request.Url.Query.Equals("?New")) { FormView2.ChangeMode(FormViewMode.Insert); } }
protected void FormView2_Load(object sender, EventArgs e) { //woResponseBLL respLogic = new woResponseBLL(); //WorkOrderTableAdapters.WOresponseTableAdapter WOrespAdapter = new WorkOrderTableAdapters.WOresponseTableAdapter(); //WorkOrder.WOresponseDataTable Responses = WOrespAdapter.GetMaxWOresponseByWOnum(Convert.ToString(Request.QueryString["word_Proj"]), Convert.ToInt32(Request.QueryString["word_WOnum"])); if (!IsPostBack) { FormView2.ChangeMode(FormViewMode.Insert); //string ls_resp2resp = Request.QueryString["wrsp_RespNum"]; //if (ls_resp2resp != null) //{ // TextBox txtBx = ((TextBox)(FormView2.FindControl("wrsp_RespToRespTextBox"))); // txtBx.Text = ls_resp2resp; //} } //else //{ // if (Responses.Count > 0) // { // FormView2.ChangeMode(FormViewMode.ReadOnly); // woUsersBLL userLogic = new woUsersBLL(); // string ls_usr = userLogic.GetFullNameByID(Convert.ToInt32(Responses[0].wrsp_uid)); // ((Label)(FormView2.FindControl("UIDlabel"))).Text = ls_usr; // } //} // FormView2.ChangeMode(FormViewMode.ReadOnly); //} //} FormViewMode fmode = FormView2.CurrentMode; //FormView2.ChangeMode(FormViewMode.Insert); }
protected void FormView2_DataBound(object sender, EventArgs e) { if (FormView2.CurrentMode == FormViewMode.ReadOnly) { if (FormView2.DataItemCount > 0) { DataRowView rowView = (DataRowView)FormView2.DataItem; string ls_val = rowView["wrsp_uid"].ToString(); int li_respNum = Convert.ToInt32(rowView["wrsp_RespNum"]); woUsersBLL userLogic = new woUsersBLL(); ls_val = userLogic.GetFullNameByID(Convert.ToInt32(ls_val)); ((Label)FormView2.FindControl("UIDlabel")).Text = ls_val; } } if (Request.QueryString["wrsp_RespNum"].ToString() != "0") { ((TextBox)(FormView2.FindControl("txtBxHeader"))).Text = "Response to Work Order Response # " + Request.QueryString["wrsp_RespNum"].ToString(); } else { ((TextBox)(FormView2.FindControl("txtBxHeader"))).Text = "Response to Work Order # " + Request.QueryString["word_WOnum"].ToString(); } }
protected void btn_submit(object sender, EventArgs e) { bll = new LogBLL(); //Connection.CreateCommand(""); String AppName = txt_AppName.Text; String environment = ddl_environment.SelectedValue; if (RadioButtonList1.SelectedValue == "Error") { error = new Error(); error.AppName = AppName; error.Severity = ddl_severity.SelectedIndex; errorlist = bll.ErrorBLL(error, environment); if (errorlist != null) { FormView2.DataSource = errorlist; FormView2.DataBind(); } } else { message = new Message(); message.AppName = AppName; messagelist = bll.MessageBLL(message, environment); if (messagelist != null) { // txt_AppName.Text = ((Message)messagelist[0]).Source; FormView1.DataSource = messagelist;//list FormView1.DataBind(); } } }
/// <summary> /// Event when user select upload picture button. It uploads the picture file to the /// App_Data directory and writes the file name for the File Name text box. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void UploadArtistImageButton_Click(object sender, EventArgs e) { FileUpload FileUploadArtistImage = FormView2.FindControl("FileUploadArtistImage") as FileUpload; if (FileUploadArtistImage.HasFile) { try { string filename = Path.GetFileName(FileUploadArtistImage.FileName); FileUploadArtistImage.SaveAs(Server.MapPath("~/Images/") + filename); lblErrorArtist.Text = "Artist Image Upload status: File uploaded!"; SiteDL.UpdateArtistImagePath(filename); FormView2.DataBind(); } catch (Exception ex) { lblErrorArtist.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message; } } else { lblErrorArtist.Text = "Could not find file"; } upPayPal.Update(); }
/*private void GetUserInfo1() * { * SqlDataSource SqlDataSource1 = new SqlDataSource(); * SqlDataSource1.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; * * SqlDataSource1.SelectCommand = @"SELECT [user_fname], [user_lname], [user_email], [user_ph_num], [user_addr1], [user_addr2], [user_city], [user_state], [user_country], [user_zip] FROM [UserInfo] WHERE [user_id] = @user_id"; * * SqlDataSource1.SelectParameters.Add("user_id", Session["Id"].ToString()); * * * DataSourceSelectArguments args = new DataSourceSelectArguments(); * DataView dv = SqlDataSource1.Select(args) as DataView; * string fname = dv.Table.Rows[0]["user_fname"].ToString(); * string lname = dv.Table.Rows[0]["user_lname"].ToString(); * customerName = fname + " " + lname; * Session["fullname"] = customerName; * dv.Dispose(); * * * FormView1.DataSource = SqlDataSource1; * FormView1.DataBind(); * * SqlDataSource1.Dispose(); * * }*/ private void GetUserInfo2() { SqlDataSource SqlDataSource1 = new SqlDataSource(); SqlDataSource1.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; SqlDataSource1.SelectCommand = @"SELECT [user_fname], [user_lname], [user_email], [user_ph_num], [user_addr1], [user_addr2], [user_city], [user_state], [user_country], [user_zip] FROM [UserInfo] WHERE [user_id] = @user_id"; SqlDataSource1.SelectParameters.Add("user_id", Session["Id"].ToString()); DataSourceSelectArguments args = new DataSourceSelectArguments(); DataView dv = SqlDataSource1.Select(args) as DataView; string fname = dv.Table.Rows[0]["user_fname"].ToString(); string lname = dv.Table.Rows[0]["user_lname"].ToString(); customerName = fname + " " + lname; Session["fullname"] = customerName; dv.Dispose(); FormView2.DataSource = SqlDataSource1; FormView2.DataBind(); SqlDataSource1.Dispose(); }
protected void lnkPost_Click(object sender, EventArgs e) { var ViewCommand = (LinkButton)sender; var postId = int.Parse(ViewCommand.CommandArgument); Session["PostId"] = postId; var postObj = _db.BlogPosts.FirstOrDefault(m => m.PostId == postId); if (postObj != null) { var blogList = _db.BlogPosts.Where(m => m.PostId == postId).ToList(); if (!blogList.Any()) { FormView2.DataSource = new List <BlogPost>(); FormView2.DataBind(); } FormView2.DataSource = blogList; FormView2.DataBind(); //Displaying the Selected Post Comment var commentList = _db.BlogComments.Where(m => m.PostId == postId).ToList(); if (!commentList.Any()) { grdComment.DataSource = new List <BlogComment>(); grdComment.DataBind(); } grdComment.DataSource = commentList; grdComment.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["book_id"] == null) { Response.Redirect("index.aspx"); } else { BookBL bookBL = new BookBL(); FormView1.DataSource = bookBL.product(Request.QueryString["book_id"].ToString()); FormView1.DataBind(); string author = ((HyperLink)FormView1.FindControl("HyperLink4")).Text.ToString(); Label15.Text = author; DataList1.DataSource = bookBL.authorBook(author); DataList1.DataBind(); //書籍內容 FormView2.DataSource = bookBL.product(Request.QueryString["book_id"].ToString()); FormView2.DataBind(); //書籍簡介 FormView3.DataSource = bookBL.product(Request.QueryString["book_id"].ToString()); FormView3.DataBind(); //留言板 GridView1.DataSource = bookBL.product_message(Request.QueryString["book_id"].ToString()); GridView1.DataBind(); } }
eticaretDataContext et = new eticaretDataContext(); // data context nesnemizi olusturdur. protected void Page_Load(object sender, EventArgs e) { stokvaryok();// Ürün stok var yok fonksiyonun çağırdık. // Veritabanımıza baglandık tabloları birleştirerek çünkü markaAD adlı kolonumuz Urunler tablosunda yoktu. //Ona ulasmak içinde Ürünler tablosu ile markalar Tablosunu birleştirdik. var urun = (from u in et.Urunlers.Where(v => v.UrunID == Convert.ToInt32(Request.QueryString["id"].ToString())) join u2 in et.Markalars on u.MarkaID equals u2.MarkaID select new { u.UrunID, u.UrunAD, u.UrunDetay, u.UrunFiyat, u.KDV, u.Resim1, u.Resim2, u.Resim3, u.Resim4, u.Resim5, u.Video, u.Taksit, u2.MarkaAD }); //Ürün Adımızı almak için veritabanımıza bağlandık. var urunad = et.Urunlers.Where(v => v.UrunID == int.Parse(Request.QueryString["id"])).FirstOrDefault(); lblAD.Text = urunad.UrunAD; // Ürün adımızı veritabanından alarak Label'ımıza atadık. FormView1.DataSource = urun; // sonucumuzu FormView'umuza attık. FormView1.DataBind(); FormView2.DataSource = urun; // Ürün Resimlerinin gösterimi için FormView2 ile bağlantımızı kurduk. FormView2.DataBind(); FormView3.DataSource = urun; FormView3.DataBind(); FormView4.DataSource = urun; FormView4.DataBind(); FormView5.DataSource = urun; FormView5.DataBind(); FormView6.DataSource = urun; FormView6.DataBind(); yorumgetir(); }
protected void InsertButton_Click(object sender, EventArgs e) { TextBox DisciplerNameTextBox = FormView2.FindControl("DisciplerNameTextBox") as TextBox; TextBox FNameTextBox = FormView2.FindControl("FNameTextBox") as TextBox; TextBox TextBox1 = FormView2.FindControl("TextBox1") as TextBox; TextBox SurnameTextBox = FormView2.FindControl("SurnameTextBox") as TextBox; TextBox Date_Of_BirthTextBox = FormView2.FindControl("Date_Of_BirthTextBox") as TextBox; TextBox Cell_NumberTextBox = FormView2.FindControl("Cell_NumberTextBox") as TextBox; TextBox EmailTextBox = FormView2.FindControl("EmailTextBox") as TextBox; DropDownList dropDownList1 = FormView2.FindControl("dropDownList1") as DropDownList; TextBox Str_NameTextBox = FormView2.FindControl("Str_NameTextBox") as TextBox; TextBox Str_NumTextBox = FormView2.FindControl("Str_NumTextBox") as TextBox; TextBox Str_SuburbTextBox = FormView2.FindControl("Str_SuburbTextBox") as TextBox; TextBox Str_TownTextBox = FormView2.FindControl("Str_TownTextBox") as TextBox; TextBox DisciplerSurnameTextBox = FormView2.FindControl("DisciplerSurnameTextBox") as TextBox; Label lblDisciplerUsername = FormView2.FindControl("lblDisciplerUsername") as Label; SqlConnection conCase = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); SqlCommand Case = new SqlCommand("Insert into Disciple (FName, Surname, Date_Of_Birth, Cell_Number, Email, Gender, Str_Name, Str_Num, Str_Suburb, Str_Town, DisciplerSurname, DisciplerName, Discipler_ID) values (@FName, @Surname, @Date_Of_Birth, @Cell_Number, @Email, @Gender, @Str_Name, @Str_Num, @Str_Suburb, @Str_Town, @DisciplerSurname, @DisciplerName, @Discipler_ID)", conCase); // Case.Parameters.AddWithValue("@Case_Id", txtCaseNumber.Text); //DateTime ts = DateTime.Now; //String DateReported = ts.ToString("MM/dd/yyy"); //String TimeReported = ts.ToString("hh:mm"); //Case.Parameters.AddWithValue("@Disciple_Id", TextBox1.Text); Disciple_Id Case.Parameters.AddWithValue("@FName", FNameTextBox.Text); Case.Parameters.AddWithValue("@Surname", SurnameTextBox.Text); Case.Parameters.AddWithValue("@Date_Of_Birth", Date_Of_BirthTextBox.Text); Case.Parameters.AddWithValue("@Cell_Number", Cell_NumberTextBox.Text); Case.Parameters.AddWithValue("@Email", EmailTextBox.Text); Case.Parameters.AddWithValue("@Gender", dropDownList1.SelectedValue); Case.Parameters.AddWithValue("@Str_Name", Str_NameTextBox.Text); Case.Parameters.AddWithValue("@Str_Num", Str_NumTextBox.Text); Case.Parameters.AddWithValue("@Str_Suburb", Str_SuburbTextBox.Text); Case.Parameters.AddWithValue("@Str_Town", Str_TownTextBox.Text); Case.Parameters.AddWithValue("@DisciplerSurname", DisciplerSurnameTextBox.Text); Case.Parameters.AddWithValue("@DisciplerName", DisciplerNameTextBox.Text); Case.Parameters.AddWithValue("@Discipler_ID", lblDisciplerUsername.Text); conCase.Open(); Case.ExecuteNonQuery(); conCase.Close(); Response.Redirect("~/Bishop/successful.aspx"); FormView FormView4 = FormView2.FindControl("formView4") as FormView; Label lblEmail = FormView2.FindControl("lblEmail") as Label; //Label EmailLabel = FormView4.FindControl("EmailLabel") as Label; //lblEmail.Text = EmailLabel.Text; }
protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Upd") { HEdit.Value = e.CommandArgument.ToString(); FormView2.ChangeMode(FormViewMode.Edit); } }
private void ProcessPicture(int id) { ArtGalleryDS.PictureDataTable table = PictureDL.GetById(id); FormView1.DataSource = table.Rows; FormView1.DataBind(); ArtGalleryDS.Picture_GetWithWaterMarkDataTable table1 = PictureDL.GetWithWaterMark(id); FormView2.DataSource = table1.Rows; FormView2.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { TextBox txt = (TextBox)FormView2.FindControl("CreatDateTextBox"); txt.Text = DateTime.Now.ToLocalTime().ToString(); if (Session["AdmName"] == null) { Response.Redirect("~/Adm/AdmLogin.aspx"); } Panel1.Visible = false; }
protected void ListView1_ItemCanceling(object sender, ListViewCancelEventArgs e) { FormView1.DataSourceID = ""; FormView1.DataSource = null; FormView1.DataBind(); FormView2.DataSourceID = ""; FormView2.DataSource = null; FormView2.DataBind(); ListView2.DataSourceID = ""; ListView2.DataSource = null; ListView2.DataBind(); }
protected void droplist_SelectedIndexChanged1(object sender, EventArgs e) { FormView1.DataSourceID = ""; FormView1.DataSource = null; FormView1.DataBind(); FormView2.DataSourceID = ""; FormView2.DataSource = null; FormView2.DataBind(); ListView2.DataSourceID = ""; ListView2.DataSource = null; ListView2.DataBind(); }
protected void updateAspUserInfo() { var newEmail = (FormView2.FindControl("EmailTextBox") as TextBox).Text; var newPhone = (FormView2.FindControl("PhoneNumberTextBox") as TextBox).Text; if (newEmail != "" && newPhone != "") { //updates e-mail address userManager.SetEmail(User.Identity.GetUserId(), newEmail); //updates phone number userManager.SetPhoneNumber(User.Identity.GetUserId(), newPhone); Response.Redirect("~/Accounts/UpdateComplete.aspx"); } }
public void oku() { // OKU ya tıklandıgında hangi siparişe gideceğinin kontrolunu yaptık ve formview 'a bilgileri getirdik. var siparisoku = et.Siparis.Where(v => v.ID == int.Parse(Request.QueryString["id"])); FormView1.DataSource = siparisoku; FormView1.DataBind(); var ssiparisoku = et.Sepet_Siparis.Where(v => v.ID == int.Parse(Request.QueryString["id"])); FormView2.DataSource = ssiparisoku; FormView2.DataBind(); btnOnayla.Visible = true; }
protected void btnAssign_Click(object sender, EventArgs e) { Panel pnlAssign = FormView2.FindControl("pnlAssign") as Panel; pnlAssign.Visible = true; TextBox TextBox1 = FormView2.FindControl("TextBox1") as TextBox; //Random rand = new Random(100000); //int ccc = rand.Next(000000, 999999999); //TextBox1.Text = ccc.ToString(); //Label EmailLabel = FormViewEmail.FindControl("EmailLabel") as Label; }
/***************************/ protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { //AccessDataSource ads = new AccessDataSource(); //ads.DataFile = "~/date/blog_Data.mdb"; Sql_StringChar sql_String = new Sql_StringChar(); //动态数据源 sql_String.ConnectionString = sql_String.sql_char; //连接字符串 sql_String.SelectCommand = "select * from blogMessages "; DataView dv = (DataView)sql_String.Select(DataSourceSelectArguments.Empty); string b_id = e.Keys[0].ToString(); sql_String.DeleteCommand = "delete from blogComments where blog_id=?";//删除留言 sql_String.DeleteParameters.Add("blog_id", b_id); Sql_StringChar sql_String3 = new Sql_StringChar(); //动态数据源 sql_String3.ConnectionString = sql_String3.sql_char; //连接字符串 sql_String3.SelectCommand = "select ca_id,blog_id from blogMessages where blog_id=" + b_id; //通过文章id查询分类id,绑定到一个隐藏控件。 DataView dv3 = (DataView)sql_String3.Select(DataSourceSelectArguments.Empty); FormView2.DataSource = sql_String3; FormView2.DataBind(); Label cid = (Label)FormView2.FindControl("ca_id");//获得隐藏控件里的控件值,即是分类id。 string c_id = cid.Text; //AccessDataSource ads2 = new AccessDataSource(); //ads2.DataFile = "~/date/blog_Data.mdb"; Sql_StringChar sql_String2 = new Sql_StringChar(); //动态数据源 sql_String2.ConnectionString = sql_String2.sql_char; //连接字符串 sql_String2.SelectCommand = "select * from blogCategory "; DataView dv2 = (DataView)sql_String2.Select(DataSourceSelectArguments.Empty); sql_String2.UpdateCommand = "update blogCategory set ca_num=ca_num-1 where ca_id='" + c_id + "'";//更新文章分类数目 sql_String2.Update(); Sql_StringChar sql_String4 = new Sql_StringChar(); //动态数据源 sql_String4.ConnectionString = sql_String4.sql_char; //连接字符串 sql_String4.SelectCommand = "select * from blogMessages "; DataView dv1 = (DataView)sql_String4.Select(DataSourceSelectArguments.Empty); string b_id1 = e.Keys[0].ToString(); sql_String4.DeleteCommand = "delete from blogMessages where blog_id='" + b_id1 + "'";//删除文章 //sql_String4.DeleteParameters.Add("blog_id", b_id1); sql_String4.Delete(); }
protected void FormView2_ItemCommand(object sender, FormViewCommandEventArgs e) { switch (e.CommandName) { case "Create": ClearRolesCheckList(); FormView2.ChangeMode(FormViewMode.Insert); break; case "Edit": string userName = GridView1.SelectedValue.ToString(); string[] userRoles = Roles.GetRolesForUser(userName); SetRolesCheckList(userRoles); break; } }
protected void FormView1_PreRender(object sender, EventArgs e) { HiddenField ID = FormView1.FindControl("ID") as HiddenField; int id = 0; if (int.TryParse(ID.Value, out id)) { Page.MetaDescription = ((Label)FormView2.FindControl("lblTitle")).Text; Page.Title = ((Label)FormView2.FindControl("lblTitle")).Text; RenderPicture(id); } else // no picture record found { Response.Redirect("default.aspx"); } }
protected void search_btn_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(); con.ConnectionString = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; SqlCommand cmd = new SqlCommand(); con.Open(); cmd.Connection = con; cmd.CommandText = "select firstname,lastname,dob,gender,country,state,address,city,pincode,email,mobileno,username from Employee where employeeid=@value"; cmd.Parameters.AddWithValue("@value", search.Text.ToString()); FormView1.Visible = false; //FormView1.DataSourceID = "SqlDataSource2"; FormView2.DataSource = cmd.ExecuteReader(); FormView2.DataBind(); }
protected void GridView2_SelectedIndexChanged(object sender, EventArgs e) { DataKey dk = GridView2.SelectedDataKey; int a = 0; FormView2.PageIndex = 0; FormView2.DataBind(); while (FormView2.DataKey.Value.ToString() != dk.Value.ToString() && a < FormView2.PageCount) { if (a + 1 < FormView2.PageCount) { FormView2.PageIndex++; FormView2.DataBind(); } } }
protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e) { if (ListBox1.Items.Count > 0) { da = new SqlDataAdapter("select bname from tbl_login where uid=" + Convert.ToInt32(Session["uid"].ToString()) + " ", con); ds = new DataSet(); da.Fill(ds, "tbl_sc1"); if (ds.Tables.Count > 0 && ds.Tables["tbl_sc1"].Rows.Count > 0) { da = new SqlDataAdapter("select tc.cid,tc.duration,tc.fee from tbl_courses tc inner join tbl_branches tb on tc.bid=tb.bid where tb.bname='" + ds.Tables["tbl_sc1"].Rows[0][0].ToString() + "' and tc.cname='" + ListBox1.SelectedItem.ToString() + "' ", con); da.Fill(ds, "tbl_course"); if (ds.Tables.Count > 0 && ds.Tables["tbl_course"].Rows.Count > 0) { FormView2.DataSource = ds.Tables["tbl_course"].DefaultView; FormView2.DataBind(); } } } }
protected void CEP_TextChanged(object sender, EventArgs e) { WebServiceCorreios.AtendeClienteClient consultaCEP = new WebServiceCorreios.AtendeClienteClient(); TextBox CEP = (TextBox)FormView2.FindControl("CEP"); if (!String.IsNullOrEmpty(CEP.Text)) { TextBox CIDADE = (TextBox)FormView2.FindControl("CIDADE"); DropDownList ESTADO = (DropDownList)FormView2.FindControl("ESTADO"); TextBox BAIRRO = (TextBox)FormView2.FindControl("BAIRRO"); TextBox ENDERECO = (TextBox)FormView2.FindControl("ENDERECO"); try { var resposta = consultaCEP.consultaCEP(CEP.Text); if (resposta != null) { CIDADE.Text = resposta.cidade; ESTADO.Text = resposta.uf; BAIRRO.Text = resposta.bairro; ENDERECO.Text = resposta.end; } } catch (Exception ex) { string display = ex.Message; ClientScript.RegisterStartupScript(this.GetType(), "Erro!", "alert('" + display + "!');", true); CIDADE.Text = ""; BAIRRO.Text = ""; ENDERECO.Text = ""; } TextBox CODSUP = (TextBox)FormView2.FindControl("CODSUP"); if (CODSUP.Text.Equals("")) { CODSUP.Text = "0"; } } }
protected void Page_Load(object sender, EventArgs e) { BookBL bl = new BookBL(); GridView1.DataSource = bl.new_Message(); GridView1.DataBind(); DataList1.DataSource = bl.chinese_Book("1"); DataList1.DataBind(); DataList2.DataSource = bl.chinese_Book("2"); DataList2.DataBind(); FormView2.DataSource = bl.chinese_Book("1"); FormView2.DataBind(); FormView5.DataSource = bl.chinese_Book("2"); FormView5.DataBind(); FormView7.DataSource = bl.chinese_Book("3"); FormView7.DataBind(); FormView1.DataSource = bl.everyday_Book(); FormView1.DataBind(); FormView4.DataSource = bl.book_top1("1"); FormView4.DataBind(); FormView3.DataSource = bl.book_top1("2"); FormView3.DataBind(); FormView6.DataSource = bl.book_top1("3"); FormView6.DataBind(); bl.book_Hit("1", HyperLink19, HyperLink20, HyperLink21, HyperLink22, HyperLink23, HyperLink24, HyperLink25, HyperLink26, HyperLink27); bl.book_Hit("2", HyperLink28, HyperLink29, HyperLink30, HyperLink31, HyperLink32, HyperLink33, HyperLink34, HyperLink35, HyperLink36); bl.book_Hit("3", HyperLink38, HyperLink39, HyperLink40, HyperLink41, HyperLink42, HyperLink43, HyperLink44, HyperLink45, HyperLink46); }