1

I'm using Castle windsor DI in my Asp.net Web Forms application. I had follow this link. It seems that everything works fine. However, I'm running into a problem with postback. I have an aspx page that contains an inject property ClientService, a GridView and a Button. I had used this following code in order to feed my GridView :

    [Inject]
    public IClientService ClientService { get; set; }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            FeedGridView();
        }
    }

    protected void FeedGridView()
    {
        grd.DataSource = ClientService.FindAll();
        grd.DataBind();
    }

It works fine... but when I click to the button that produce a Postback, the GridView disappears. NOTA : this problem turns on just when I'm using DI container. When I had a test without it, the GridView stayed appeared after the Postback.

How to keep the GridView after a postback by keeping the use of Castle windsor?

Regards,

Community
  • 1
  • 1
  • a gridview doesn't just disappear. The 'disappearing' gridview is probably just a visible effect because something else didn't work out as expected. Look at the HTML after postback and see if the basic markup of your gridview is still there. Maybe it only misses the data to show up in your browser. Try debugging your web form and see what happens during postback. – Dirk Trilsbeek Sep 15 '14 at 12:50
  • I had checked generated HTML after the postback, I didn't find the GridView, '
    – user2469205 Sep 15 '14 at 14:35

0 Answers0