I have got a code, on procedure Button_Click:

  protected void Button2_Click(object sender, EventArgs e)
                using (SPWeb witryna = SPContext.Current.Web)

                    // Dodawanie poszczególnych dni projektowych
                    SPListItemCollection listItems = witryna.Lists["Szczegoly"].Items;
                    SPListItem item = listItems.Add();
                    item["Kontrakt"] = TextBox1.Text;
                    item["Pracownik"] = TextBox2.Text;
                    item["Dzien"] = TextBox3.Text;
                    var selectedGroup = DropDownList2.SelectedItem;
                    item["Procenty"] = new SPFieldLookupValue(int.Parse(selectedGroup.Value), selectedGroup.Text);

                    string DateOnlyQuery = "<Where><Eq><FieldRef Name='{0}' /><Value Type='DateTime'>{1}</Value></Eq></Where>";
                  //  string FullQuery = "<Where><And><Eq><FieldRef Name='{0}' /><Value Type='DateTime'>{1}</Value></Eq><Eq><FieldRef Name='Pracownik' /><Value Type='Text'>{2}</Value></Eq></And></Where>";
                    string dateISO = SPUtility.CreateISO8601DateTimeFromSystemDateTime(Convert.ToDateTime(TextBox3.Text).ToLocalTime());

                    var query2 = new SPQuery();
                    query2.Query = String.Format(DateOnlyQuery, "Data", dateISO);
                    query2.ViewFields = "<FieldRef Name='Data' />";
                    query2.ViewFieldsOnly = true;
                    SPListItemCollection listaDniSwiatecznych = witryna.Lists["DR2013 Święta"].GetItems(query2);

                    foreach (SPListItem olistaDniSwiatecznych in listaDniSwiatecznych)
                        Label2.Text = olistaDniSwiatecznych["Kontrakt"].ToString();

                    // Zaktualizowanie wpisu w liscie projektów
                    this.TextBox1.Text = "";
                    this.TextBox2.Text = "";
                    this.TextBox3.Text = "";
                    Label2.Text = "Dodałeś nowy wpis";

If I try listing items on label in or not in Update Panel, I can't see anything. Any code doesn't listing on site. I don't see any writings. It's don't see label. Here of declaration of update panel:

`<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">



I did it by erase a using method from this line:

SPWeb witryna = SPContext.Current.Web;

And now it's works good.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.