Beispiel #1
0
        protected void editLinkButton_Command(object sender, CommandEventArgs e)
        {
            long susretId   = Convert.ToInt64(e.CommandArgument);
            var  linkButton = sender as LinkButton;

            // We want to hide clicked icon in the grid
            // to know which record (row in the grid) is being edited.
            if (linkButton != null)
            {
                linkButton.Visible = false;
            }

            if (e.CommandName == "edit")
            {
                editPanel.Visible = true;
                IsEditMode        = true;

                // Put SusretId in the ToolTip of the text box
                // so it can be used to find record before updating it.
                domacinTextBox.ToolTip = susretId.ToString();

                var susret = _susretRepository.GetSusret(susretId);
                domacinTextBox.Text = susret.Domacin;
                gostTextBox.Text    = susret.Gost;
            }
            else if (e.CommandName == "link")
            {
                Response.Redirect($"~/Ponude.aspx?susretId={susretId}");
            }
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                IsEditMode = false;

                if (!long.TryParse(Request.QueryString["susretId"], out long susretId))
                {
                    // Ne postoji taj SusretId. Vraćamo se na stranicu susreta.
                    Response.Redirect("~/Susreti");
                }

                SusretId = susretId;

                try
                {
                    var susret = _susretRepository.GetSusret(susretId);
                    susretLabel.Text = susret.ToString();
                }
                catch
                {
                    // Ne postoji taj SusretId. Vraćamo se na stranicu susreta.
                    Response.Redirect("~/Susreti");
                }
            }

            Search();
        }