0

I know this is an old question and answered multiple times, but they don't solve my problem. I've seen several questions like this and this.

So I'm simply trying to pass my ID value using querystring like :-

$scope.MaterialView = function (ID) {
        ClassFactory.RedirectMaterialView(ID).then(function (d) {
            //$window.open(d.data, '_blank');
            var queryString = d.data + '?id=' + ID;
            var popup = window.open(queryString, '_blank');

            if (popup) {
                popup.onload = function () {
                    console.log(popup.innerHeight > 0 ? '' : alert('Pop_Up Blocked By Your Browser'));
                }
            } else {
                alert('Pop_Up Blocked By Your Browser');
            }
        }, function (error) {
            alert('Cannot Redirect to Material');
        })
    }

Now this is giving me result as :-

http://localhost:31015/Home/ClassMaterial?id=122

But I'm not able to access id in my c#.

I tried this:-

dbundle.MaterialFetchID = Convert.ToInt32(Request.QueryString["id"]);

and this:-

public ListViewModel FetchMaterialDetail(string id)    
    {
        dbundle = (DataBundle)TempData["DBundle"];
        dbundle.MaterialFetchID = Convert.ToInt32(id);

Both of them are giving me null values. Any help is appreciated.

3
  • dbundle.MaterialFetchID.... where did you write this code? In controller action? Can you share the relevant code of ClassMaterial action method? Commented Apr 23, 2018 at 1:36
  • you mean it is calling the action method but the id value is not getting passed? Commented Apr 23, 2018 at 4:46
  • @ChetanRanpariya Yes you gave me the hint for error. It was going to the ClassMaterial action Method. With your help I resolved it. Thanks. Commented Apr 23, 2018 at 16:10

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.