Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

how to echo the database contents in codeigniter while editing -


how form field contents while editing (updating) entries in database ?

my controler

//edit sidebar contents function edit_lsidebar(){          if(isset($_post['heading'])){         //adding text fields         $heading = $this->input->post('heading');         $content_text = $this->input->post('content_text');         $url = $this->input->post('url');         $link_text = $this->input->post('link_text');          $this->lside_bar_model->edit_lsidebar($heading, $content_text, $url, $link_text);          redirect('welcome');     }     else $this->load->view('edit_lside_bar', $data);     } 

my model is

function edit_lsidebar($heading, $content_text, $url, $link_text){           $data = array(     'heading'=>$heading,     'content_text'=>$content_text,     'url'=> $url,     'link_text' => $link_text     );      $this->db->where('id',$this->uri->segment(3));     $this->db->update('lsidebar', $data);  } 

please help

when loading edit_lside_bar view pass existing $heading, $content_text, $url, $link_text variables data array you're passing view.

then inside view echo values value attribute input fields. example:

inside controller:

else {  $data["lside_bar"] = $this->lside_bar_model->get_lside_bar($id);  $this->load->view('edit_lside_bar', $data);   } 

inside view:

<input type="text" name="heading" value="<?php echo $lside_bar->heading; ?>" /> <textarea name="content_text"><?php echo $lside_bar->content_text; ?></textarea> .... 

that should give nice push in right direction. hope helps!


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -