[Mono-bugs] [Bug 417872] gridview selectcommand has error

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Aug 18 03:15:47 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=417872

User miblogic at yahoo.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=417872#c3





--- Comment #3 from Michael Buen <miblogic at yahoo.com>  2008-08-18 01:15:47 MDT ---
work-around i employ in order not to make big changes for my program to work in
mono asp.net



  protected void grd_RowDataBound(object sender, GridViewRowEventArgs e)
   {

      if (e.Row.DataItem == null) return;

      DataRowView rx = (DataRowView)e.Row.DataItem;

      LinkButton lb = e.Row.FindControl("selRecord") as LinkButton;


/* this was the code before 
lb.CommandArgument =  (string)rx["tlist_rec_id"] + ":" +
((bool)rx["has_prelim_result"]).ToString(); */



lb.CommandArgument =  e.Row.RowIndex.ToString() + ":" +
(string)rx["tlist_rec_id"] + ":" + ((bool)rx["has_prelim_result"]).ToString();


 }



   protected void selRecord_Command(object sender, CommandEventArgs e)
   {




      string[] s = ((string)e.CommandArgument).Split(':');

/* this was the code before
      string tlistRecId = s[0];
      bool hasApprovedTr = Convert.ToBoolean(s[1]); */



/* 

s[0] is the GridViewRow.RowIndex.  in OnBubbleEvent we extract the s[0] to pass
it to base.OnBubbleEvent.  see class MycGridView below

*/
      string tlistRecId = s[1];
      bool hasApprovedTr = Convert.ToBoolean(s[2]);


      Session["selected_tlist_rec_id"] = tlistRecId;

      ShowOptions(true, hasApprovedTr, false);


   }










namespace Myc
{
   public class MycGridView : GridView
   {      
      protected override bool OnBubbleEvent(object source, EventArgs e)
      {
         GridViewCommandEventArgs ea = (GridViewCommandEventArgs)e;

         if (ea == null)
            return base.OnBubbleEvent(source, e);
         else
         {
            if (ea.CommandName == "Select")
            {
               string[] s = ((string)(ea.CommandArgument)).Split(':');
               // s[0] is the 
               GridViewCommandEventArgs x = new
GridViewCommandEventArgs(source,
                     new CommandEventArgs("Select", s[0]));
               return base.OnBubbleEvent(source, x);

            }

            else

               return base.OnBubbleEvent(source, e);

         }

      }

   }



}


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list