Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
40
Stop Postbacking on ItemCommand event
posted

Hello Friends,

   I am  using Infragistics controls in my application first time, and i am facing the following issue.

What I am trying to implement is:

   I am using a WebDataGrid and i have kept a ImageButton inside a Template field in the grid. my requirement is onclick of the ImageButton i need to create a panel dynamically with some values and that i am implementing in Itemcommand event.

But the problem i am facing is on click of the Imagebutton the post back is happening which i dont want. Can anyone help me how to stop Postback.

Code in ItemCommand:

  protected void WebDataGrid1_ItemCommand(object sender, Infragistics.Web.UI.GridControls.HandleCommandEventArgs e)
        {
           
            string commandname = e.CommandName;
 
            if (commandname == "image")
            {
                pan.Visible = true;
                RowIndex = Convert.ToInt32(e.CommandArgument);
                PromotionID = WebDataGrid1.Rows[RowIndex].Items[0].Value.ToString();
                Status = WebDataGrid1.Rows[RowIndex].Items[2].Value.ToString();
                
                pan.Visible = true;
                pan.Style.Add(HtmlTextWriterStyle.Width, "100px");
                pan.Style.Add(HtmlTextWriterStyle.Height, "100px");
                pan.Style.Add(HtmlTextWriterStyle.BorderColor, "black");
                pan.Style.Add(HtmlTextWriterStyle.BorderWidth, "1px");
                pan.Style.Add(HtmlTextWriterStyle.BorderStyle, "Solid");
                pan.Style.Add(HtmlTextWriterStyle.Top, ( 150+(RowIndex*20)+"px").ToString());
                pan.Style.Add(HtmlTextWriterStyle.Left, "500px");
                pan.Style.Add(HtmlTextWriterStyle.ZIndex, "102px");
                pan.Style.Add(HtmlTextWriterStyle.Position, "absolute");
                pan.Style.Add(HtmlTextWriterStyle.BackgroundColor, "White");
 
                foreach (KeyValuePair<string,List<string>>  pair   in dic)
                {
                    if (Status == pair.Key)
                    {
                        for (int i = 0; i < pair.Value.Count; i++)
                        {
                            LinkButton lnkbtn = new LinkButton();
 
                            lnkbtn.Text = pair.Value[i].ToString() +"</br>";
                            lnkbtn.ID = "LinkButton" +( RowIndex + 1);
                            lnkbtn.PostBackUrl="About.aspx? PromotionID=" +PromotionID;
                            pan.Controls.Add(lnkbtn);
                        }
                    }
                }
                Form.Controls.Add(pan);
             //   RaiseBubbleEvent(this, e);  // not working
           //     e.Handled = true;
            
 }
 
    Please help me out....

Thanks  & Regards,
Joyanta

 

Parents
No Data
Reply Children
No Data