Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / September 2007

Tip: Looking for answers? Try searching our database.

Problem in OnItemDataBound

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
yme - 13 Sep 2007 17:22 GMT
Hi guys,

I have a datagrid with 4 columns, in the 2nd column I have a Label and
in the 4th a DropDown.

As I want to change the content of the DropDown according with the
content of the label I've built a function that executes on
ItemDataBound:

protected void dgCriteriosDB(object sender, DataGridItemEventArgs e){
    //identification for the criteria
    int idCriterio = 0;

   if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType ==
ListItemType.AlternatingItem))
   {
      Label lbl_idCriterio =
(Label)e.Item.FindControl("lbl_idCriterio");
      Label lblCriterio = (Label)e.Item.FindControl("lbl_criterio");
      idCriterio = System.Convert.ToInt32(lbl_idCriterio.Text);
      //change the select statement
      src_subCriteriosAval.SelectCommand="SELECT [id_subcriterio],
[id_criterio], [desc_sub_criterio], [imp_relativa], [ordem] FROM
[MSP_PMO_Scoring_SubCriteriosAvaliacao] WHERE ([id_criterio]
="+idCriterio+")";
      /apply the select statement
      DropDownList  dg3 =
(DropDownList)e.Item.FindControl("drpSubCriterios");
      dg3.DataSourceID  = "src_subCriteriosAval";
       dg3.DataTextField = "desc_sub_criterio";
      dg3.DataValueField ="imp_relativa";
      dg3.DataBind();
   }

}

The function seems to be woorking well but if it fires for each row,
why does it change all the previous records?
Sam - 14 Sep 2007 18:45 GMT
What do you mean by "why does it change all the previous records"? Did you
mean that all previous records become null/empty or blank space?

Sam

> Hi guys,
>
[quoted text clipped - 34 lines]
> The function seems to be woorking well but if it fires for each row,
> why does it change all the previous records?

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.