w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Nsstring data isnt retianed after passing a controller
You can create a Macro.h file and create AppDelegate var like this extern AppDelegate *delegate; In AppDelegate declare like this AppDelegate *delegate; and in appdelegate:DidfinishlaunchingwithOptions: do like this delegate = [[UIApplciaiton sharedApplication]delegate]; and then declare one NSString *string in appdelegate and create iVar and property,synthesize it and make it a copy type property and in viewcontroller1 assign delegate.string = @""; in viewcontroller you can access like NSString *string1 = delegate.string; If you get any error saying delegate not found in viewcontroller1 or viewcontroller2 then import appdelegate and macro.h file in viewcontroller1 and viewcontroller2 Cheers:)

Categories : Iphone

Passing data in NSString format from LoginViewController to FirstViewController
If you are using StoryBoards I'd strongly suggest you use segues to call the different view controllers. That way you can push vc's and pass info relatively easily. You can override the native method prepareForSegue in your Login VC, and set the properties there. You can name your segue id as anything in the storyboard. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([[segue identifier] isEqualToString:@"firstVC"]) { FirstViewController *firstVC = [segue destinationViewController]; firstVC.emailString = EmailField.text; } } if you really want, and I'd advise against it vs. using static variables is NSUserDefaults. [[NSUserDefaults standardUserDefaults] setObject:EmailField.text forKey:@"emailString"]; to get it back l

Categories : Objective C

My NSString data didnt tranfer over to a view controller
You should use delegation: the earlier (overview) controller (the one you navigate back to) should implement a protocol the detail view controller defines. the earlier controller will set itself as delegate of the detail controller just before presenting. when being presented and navigation back from detail to overview controller is about to happen, the detail controller can inform (aka send a message including the string as an parameter object)the overview controller just before it is dismissed.

Categories : IOS

Passing data from view controller to tab bar controller in iOS
First thing: 1- You want to pass the data to your tab for some reason... or: 2- You want to pass the data to your tab so then you can pass to another UIViewController? If it's the second option, the most common pattern for that is the Singleton. Where you can keep common data, that can be used/reused by different parts of the application.

Categories : IOS

Change value of NSString in a controller which is created in didFinishLaunchingWithOptions and reload that controller
You can make a refresh Method in leftMenuViewController or make property of your NSString. Define SideMenuViewController*leftMenuViewController inAppdelegatefile and make itproperty,synthesizeit. Now you are able to refresh yourleftMenuViewControllerwith yourNSString` with this: AppDelegate *appDelegate = [UIApplication sharedApplication]; [appDelegate.leftMenuViewController refresh:yourStr];

Categories : IOS

Passing Data from a View Controller to a First Detail Controller and then to a Second Detail Controller
To pass the data to the second ViewController, just do exactly the same thing as you did in the first ViewController: pass the reference of the Color object in the segue. In the SecondDetailViewController, you already have a color property. You just have to set this property with the same Color object that was selected in your ColorBookViewController. As you already have this reference in the ColorDetailViewController, just pass it directly to the SecondDetailViewController, via segue. Inside your ColorDetailViewController: -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier isEqualToString:@"showMoreDetail"]) { SecondDetailViewController *destViewController = segue.destinationViewController; destViewController.color = self.color;

Categories : IOS

Data passing between Controller and DAO within PHP MVC project
Using model objects to transfer data to DAO. The reasons I see are: Better maintainability Re-use models elsewhere and in many situations Have Model specific methods in the model class and Data specific ones in the Data Access layer. Sending back the model objects in JSON to the View all the time.

Categories : PHP

Passing data from one controller to other Angular
What about creating some kind of a message bus in your app? First, create a MessageBus service: module.factory("MessageBus", function($rootScope) { return { broadcast : function(event, data) { $rootScope.$broadcast(event, data); } }; }); Then, inject it to the originator controller: function OriginatorController($scope, MessageBus) { $scope.funct = function(e) { // get data MessageBus.broadcast("data", data); }; }; And subscribe to events anywhere you want: $scope.$on("data", function(arguments) { console.log(arguments); }); You can even use $rootScope directly via DI and call $broadcast on it in your controllers, but creating a service is more expressive. EDIT: Here is a pen for you.

Categories : Angularjs

Passing data from Controller to View in a PHP MVC app
My guess that the reason could be simply "less typing", but that have some nice side effects: Helps when the ones writing the templates are not familiar with php and this way they don't have to be concerned with the "what could this $this-> mean?". Having a separate container for the variables also helps when there are some properties of the view that should be private to that class and the library writers doesn't want to expose them to the template writers Prevents name collisions with the view's own properties and the variables for the templates. Much faster than method based access schemes. Might not be as relevant now as it was when for example smarty was created (worked with php4 too).

Categories : PHP

mvc passing data between controller and view
Yes, it's possible, but actually now very logical way to to this. Lets follow your way. You have some View were you have a button, that will trigger this action. For ex: public ActionResult Index() { return View(); } Inside view you can have a Ajax link, that will trigget your getRecord method: <div id="GetDataDiv"></div> <div> @Ajax.ActionLink("Get Record", "getRecord", "ControllerName", null, new AjaxOptions() { HttpMethod = "GET", UpdateTargetId = "GetDataDiv" }) </div> In the getRecord method you should have: public ActionResult getRecord() { DataModel f_DM = new DataModel(); DataTable f_DT = f_DM.getRecord(); return PartialView(f_DT); } And in View it should be: @model DataTable @Model.PropertyOne @Model.PropertyTwo It should works for you. Ac

Categories : Asp Net Mvc

Passing label data from one view controller to the other
FirstController -(void)calculateAnswer{ int answer=[self.firstInput.text intValue] + self.secondInput.text intValue]; SecondController *controller=[[SecondController alloc] initWithNibName:@"SecondView" bundle:nil]; //Answer is a PUBLIC property declared in SecondController controller.answer=[NSString stringWithFormat:@"%d",answer]; [self.navigationController pushViewController:controller animated:YES]; } SecondController In SecondController.h @property(nonatomic, retain)NSString *answer; In SecondController.m -(void)viewDidLoad{ [super viewDidLoad]; self.lblAnswer.text=self.answer; }

Categories : Iphone

Passing data to a Controller method via POST
You have to save questionList as a hidden field on the page. Non-primitive types do not get persisted simply by passing them in. One way you can do that is @Html.HiddenFor(m => m.Foo) Or you could do it directly in HTML like this <input type="hidden" name="Var" value="foo"> where m is your model.

Categories : C#

Passing javascript data with laravel controller
Perhaps you can use the Session laravel method. Then you can set active: {{ Session::get('tab_index') }}, for example. Only works for blade templates (templateName.blade.php)

Categories : Jquery

Rails passing data from a view to a different controller
One option would be to create a custom action in that controller. class YourController def custom_action_for_different_view @your_integer = params[:id] render or redirect_to end end You would also need to add an entry in your routes.rb so rails nows how to handle the route. get "custom_url" => "your_controller#custom_action_for_different_view" and of course use that url in your first view (which displays the integer which will be clicked).

Categories : Ruby On Rails

CodeIgniter variable data/ value not passing to the view from the Controller
Try like: $this->load->view('reports/bqt_daily_income_view', array('highcharts' => $highcharts)); In view file: echo $highcharts; Alternative post method: $this->data['highcharts'] = json_encode($json_data); $this->data['other'] = "bla bla bla"; $this->load->view('reports/bqt_daily_income_view', $this->data); In view file: echo $highcharts; echo $other;

Categories : PHP

Passing strongly-typed data from a View to a Controller
The fact that your view is strongly typed to @model MyNamespace.Customer doesn't mean that this model will somehow be automagically posted to your action when the form is submitted. Basically you need to have input fields for each property you want to retrieve inside your form if you want this property to be passed to your POST action. Also make sure that this Customer object is a POCO with a default (parameterless) constructor where each property you would like to retrieve has public getters and setters. Otherwise the default model binder will never be able to deserialize the request to this model. The ideal solution to this problem is to use a view model which is a class that you specifically design to meet the requirements of your view and stop passing your domain models to it. This vi

Categories : C#

Error on passing data from controller to view of Codeigniter
You are not passing any data to your views. You can use the 2nd parameter to pass data to your views so rather than doing $this->load->view('header'); $this->load->view('register_user'); $this->load->view('footer'); You want to do $aData['errors'] $this->load->view('header', $aData); $this->load->view('register_user', $aData); $this->load->view('footer', $aData); Then when you are in your view you can do <h2>Register User</h2> <?php if($errors): ?> <div style="background:red;color:white;"> <?php echo $errors; ?> </div> <?php endif; ?>

Categories : Codeigniter

Redirecting to another action in same controller and passing some data asp.net mvc3
Redirect to Index action. Use return RedirectToAction("Index","Home"); Pass the value of param from SomeAction to Index. You can use the TempData object. The TempData property value is stored in session state. Any action method that is called after the TempDataDictionary value is set can get values from the object and then process or display them. The value of TempData persists until it is read or until the session times out. You can do it as below: public ActionResult Index() { //you can access TempData here. } public ActionResult SomeAction() { if (isFailed) { TempData["Failure"] = "Oops, Error"; //store to TempData return RedirectToAction("Index" , "Home"); } return View(); } This MSDN article explains it all. Keep the URL: http://localhost

Categories : C#

MVC Passing Four Pieces of Data to the Controller and subsequently to the View
After much cursing and even more red squiggly lines, I figured out a couple ways to do this and neither involves a tuple: First Method: ViewModel: public IEnumerable<OrderSummary> Orders { get; set; } public decimal? GrossProfitTotal { get { return Orders.Sum(s => (decimal)s.Profit); } } public decimal? CommissionTotal { get { return Orders.Sum(s => (decimal)s.Commission); } } public decimal? NetProfitTotal { get { return GrossProfitTotal + CommissionTotal; } } Controller: var orderssummary = new OrdersSummary(); var viewModel = new OrderSummary { Orders = orderssummary.GetOrders(sortOrder, searchString), } return View(viewModel); Second Method: ViewModel: public IEnumerable<OrderSummary> Orders { get; set; } public decimal? GrossProfitTotal { get; s

Categories : Asp Net Mvc

Passing data from a parent to child controller to a view
You need to create a class property to have it available to the child class: class Backend_Controller extends MY_Controller { public $data; public function __construct() { parent::__construct(); $this->data['cms_name'] = $this->config->item('cms_name'); } }

Categories : PHP

IEnumerable data not passing back from view to controller
Might need to wrap your inputs in a form: @using (Html.BeginForm()) { @foreach (var item in Model) { @Html.CheckBoxFor(modelItem => item.IsActive, new { @value = item.Id }) @Html.DisplayFor(modelItem => item.Name) } <input type="submit" value="Save" /> }

Categories : C#

Passing data to next view controller with modal segue
declare a property @property (nonatomic, strong)NSString *userFulName; in the UserDetails.h file. In your prepare for segue method UD.userFulName = self.userFullNameString; then in the viewDidLoad of your next view controller(i.e. UserDetails) userFullName.text = userFulName;

Categories : IOS

Passing data from one view controller to other view controller through xib file
Sorry , I couldn't get why you have done these two line code : tempView.fullName = self.nameTextField.text; [tempView setFullName:self.fullName]; Instead , Make a property of NSString in Second View Controller's .h file @property (nonatomic,retain) NSString *strFullName; and synthesize in .m file. @synthesize strFullName; Now , -(IBAction)nextVCButton:(id)sender { SecondViewController *tempView = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil]; NSLog(@"name : %@",self.nameTextField.text); tempView.strFullName = self.nameTextField.text; [self.view addSubview:tempView.view]; }

Categories : Iphone

Passing data via POST from an element to controller/model Cakephp
Please, check input specification you can see there, that there are no "uploader" value for type attribute. Maybe you mean type="file". Also, if you want to upload files, please, use echo $this->Form->create('File', array('type' => 'file')); this will produce correct enctype attribute enctype="multipart/form-data". such enctype needed if you send files by POST. Also, you use style: style="visibility: hidden;" which should hide file input field, so, maybe you use some flash uploader or ajax, but this is not demonstrated in your code. If you provide more code, we can provide more concrete help to you. and counter question: how you debug your code?

Categories : Cakephp

MVC4 passing all form data (model) from javascript to controller -- is it possible?
Basically, you can do it calling an AJAX POST: JS (using jQuery): $('form').on('submit', function (event) { // Stop the default submission event.preventDefault(); // Serialize (JSON) the form's contents and post it to your action $.post('YourAction', $(this).serialize(), function (data) { // If you want to do something after the post }); }); Controller Action: public ActionResult YourAction(string JSONmodel) { System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer(); MyModel model = serializer.Deserialize(JSONmodel, typeof(MyModel)); // Now you can do whatever you want with your model } UPDATE For more complex objects, you can use a third part solution for serialization/de

Categories : Javascript

ASP MVC 4 - binding and passing data from view to controller in repeating controls
The main problem is that the default model binder cannot create an instance of an interface. Try to be more specific, i.e. public ActionResult CommiteePage(ImplementedCommiteeType commitee). You can also create a CommiteeViewModel: ICommitee class in which you can transport your structures (in Controllers and Views only). Or you can create your own model binder which knows what to implement. This is slightly more complicated.

Categories : Asp Net Mvc

Passing NSString from one class to another. (ECSlidingViewController?)
If you want to use ViewInit as a common store of settings it should be a singleton so that all other instances in the app can get it. Currently you're creating a new instance each time you want to use it, so the new instance doesn't have any of your previous settings. Aside, I know what the sliding view controller is, I ask about it because you may be using it incorrectly. If you have a view controller which is the current top view controller and it changes the top view controller (class A might be doing this, not sure) then the reference self.slidingViewController will stop working part way through your code.

Categories : IOS

Codeigniter validation, passing form data from controller function recipient to another
Your php logic is wrong: if ($this->form_validation->run() == FALSE) { // If validation fails load view // $this->insertbook(); $this->load->view('showbooks'); } else { //If validation pass insert book // $this->load->view('showbooks'); $this->insertbook(); } Also this $duplicate = $this->_searchbook('book_name',$data['book_name']); you can replace with validation rule: $this->form_validation->set_rules('book_name', 'Name of book', 'is_unique[table.column]'); For your "only numbers problem" -> $this->form_validation->set_rules('bkyear', 'Year', 'numeric'); Furthermore you can find a lot of build-in rules here: http://ellislab.com/codeigniter/user-guide/libraries/form_vali

Categories : Codeigniter

How to retain my nsstring when popping to another view controller
I followed this answer and it worked great: http://stackoverflow.com/a/9736559/2670912. I found that using a protocol worked the best for me. And it helped me avoid rigidity.

Categories : Iphone

Passing whole object instance (that contains an empty List) from View -> Controller results in List.Count==1 in Controller
Use explicit for loop instead of a foreach loop, and reference your elements by their index Have a look at this: http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx It's a bit old but still applies.

Categories : Asp Net Mvc

Passing the property from controller to view not working? or am I passing wrong property?
if you want the proper item with an Id = some id to display, you need to select the record by Id. in your code, add a where clause to your linq select statment, it could be... var module = (SbSis.Modules.Where(t => t.ID == id).Select( ....

Categories : Asp Net Mvc

DynamoDB - how to extract NSString from Data set
In DynamoDB, an attribute can be of only one type (String, Number, Binary, StringSet, NumberSet, BinarySet). The object that you are printing out is of type "String", and has the content "Will". Dynamo would probably be clearer if it printed it like this: {S:Will} But instead it's just converting the AttributeValue to a String, and showing you all of the other (empty) values inside of it: {S: Will,N: (null),B: (null),SS: ( ),NS: ( ),BS: ( ),} Everything else is just noise; all that's important is that it's a String with the content "Will".

Categories : IOS

The best way to read formatted data from NSString?
Try using NSString methods like this: NSArray *vals = [string componentsSeparatedByString:@" "]; float f1 = [vals[1] floatValue]; float f2 = [vals[2] floatValue]; float f3 = [vals[3] floatValue];

Categories : IOS

saving NSString from Core Data
Need more code, but try this code : @synthesize courseNameValue; NSString *f = [NSString stringWithFormat:@"%@", courseNameValue.text]; [newRound setValue:courseName forKey:@"roundCourseName"]; ps check the courseNameValue

Categories : Xcode

Passing a class object from one controller action to different controller action in ASP.net MVC 4
use this return RedirectToAction("ActionName", "ControllerName", modelObj); in your case return RedirectToAction("CreateNewProject", "Course", courseViewModel); You can also use TempData

Categories : Asp Net Mvc

Core Data and NSSortDescriptor not sorting according to third descriptor based on NSString
This is the line that is not being properly applied (for the RED card case): NSSortDescriptor *isHomeTeam = [[NSSortDescriptor alloc] initWithKey:@"team.homeMatch" ascending:NO]; Without seeing your data model and some of the sample data, it's hard to say why this would not be sorting properly. I would assume this would put NIL values first, then proper values next (so sorting ascending NO would do what it's doing in the YELLOW card case). If I was in this situation, I would check my assumptions about sort order and these team.homeMatch properties. Do a test where this is the only sort description. Then focus in on what is different with the RED/YELLOW card condition.

Categories : IOS

Passing $id to a controller
The error is clear: Argument 1 passed to GooddayPreditBundleEntityMedida::setHijo() must be an instance of GooddayPreditBundleEntityHijo, string given You must pass an Hijo object to the method setHijo $hijo = $em->getRepository('GooddayPreditBundle:Hijo')->find($id); $medida->setHijo($hijo); Hope it's helpful. Best regard.

Categories : Function

Passing an int array to MVC Controller
To pass an array of simple values in MVC, you simply need to give the same name to multiple values e.g. The URI will end up looking something like this /{controllerName}/EditAll?ids=1&ids=2&ids=3&ids=4&ids=5&currentId=1 The default model binding in MVC will bind this to the int array Action parameter correctly. Now, if it were an array of complex values, there are two approaches that can be taken for model binding. Let's suppose you have a type like so public class ComplexModel { public string Key { get; set; } public string Value { get; set; } } and a controller action signature of public virtual ActionResult EditAll(IEnumerable<ComplexModel> models) { } For model binding correctly, values need to include an indexer in the request e.g. /{contr

Categories : Javascript

View not passing Id to controller
Your not getting anything in there because your not passing anything to the controller. it is getting a default object. There is no form on there to pass back data in a POST. Normally for a delete or edit on a grid you would add the ID of the record onto the route and use that to edit/delete your object. So public ActionResult DeleteModule(ModuleVM moduleVM) becomes public ActionResult DeleteModule(long Id) and your action link becomes <li>@Html.ActionLink("Delete", "DeleteModule","Module", new { Id = entry.Id })</li> Then change your code to use the Id and delete the record.

Categories : C#

Passing value from view in controller
I don't think it's because params[:tableno] is nil I think it is because you haven't initialized @totamount. Then when you try to add the first order.amount to it you are getting an error because you can't add to nil. Try either setting @totamount = 0 before your loop or doing: @totamount = order.map(&:amount).inject(&:+) To add all the amounts together.

Categories : Ruby On Rails



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.