Exemple #1
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            findCaller.Value = "";
            var data    = GridView1.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[0]; //get hidden Song_ID
            var dataStr = GridView1.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[1]; //get hidden Song_Singer

            if (e.CommandName.ToLower().Trim() == "Add".ToLower().Trim())
            {
                // Convert the row index stored in the CommandArgument
                // property to an Integer.
                int index = Convert.ToInt32(e.CommandArgument);

                // Get the last name of the selected author from the appropriate
                // cell in the GridView control.

                //GridViewRow selectedRow = GridView1.Rows[index];
                //TableCell Song_Id = selectedRow.Cells[1];
                //CrazyKTVWCF.wcf_addsong(Song_Id.Text.Trim());

                CrazyKTVWCF.wcf_addsong(data.ToString().Trim());
            }
            else if (e.CommandName.ToLower().Trim() == "Insert".ToLower().Trim())
            {
                // Convert the row index stored in the CommandArgument
                // property to an Integer.
                int index = Convert.ToInt32(e.CommandArgument);

                // Get the last name of the selected author from the appropriate
                // cell in the GridView control.
                //GridViewRow selectedRow = GridView1.Rows[index];
                //TableCell Song_Id = selectedRow.Cells[1];
                //CrazyKTVWCF.wcf_insertsong(Song_Id.Text.Trim());

                CrazyKTVWCF.wcf_insertsong(data.ToString().Trim());
            }
            else if (e.CommandName.ToLower().Trim() == "Singer".ToLower().Trim())
            {
                //clean up data on display
                GridView1.DataSource = null;
                GridView1.DataBind();
                hideAllGridViewPanel();
                Panel2.Visible     = true;
                BNext.Visible      = false;
                BPrevious.Visible  = false;
                songDGpage.Value   = "0";
                LPageNumCount.Text = "1";

                findCaller.Value = "toTop";
                string _singer = dataStr.ToString().Trim(); // singer
                // gvMode.Value = data.ToString();
                tSearch.Text = _singer;
                SingerSongList(0, 100, _singer);
                ddSearchType.SelectedIndex = 1;
            }
        }
 protected void bAdd_Click(object sender, EventArgs e)
 {
     CrazyKTVWCF.wcf_addsong(tSongNumber.Text.Trim());
 }