adding textbox to datagrid cell dynamically

Results 1 to 2 of 2

Thread: adding textbox to datagrid cell dynamically

  1. #1
    Join Date
    Dec 1969

    Default adding textbox to datagrid cell dynamically

    Hi All,<BR><BR>I&#039;ve been trying to add a textbox dynamically in the datagrid online but it just confuses me..:(<BR><BR>scenario is like this...i have a Location column that gets the value from the database ..some records though as no Location so I wanted to insert a textbox instead for them to enter in the location....<BR><BR>i wanted to do &#039;if then else&#039; statement in the HTML view but not sure how..i&#039;m using this &#060;%# DataBinder.Eval(Container.DataItem, "Location") %&#062; to check whether its empty or not ... by the way i&#039;m using C#...<BR><BR>am extremely grateful if anybody can provide any help in this..because i can;t move on because of this ...:( and i&#039;ve also just started doing .net ... :)

  2. #2
    Join Date
    Dec 1969

    Default you're MUCH better off

    taking the opposite approach<BR><BR>ALWAYS have the textbox there (which allows you to declare the control inside the &#060;asp:datagrid&#062;), but hide it on rows you don&#039;t need it on (do this in the "OnItemDataBound" event)<BR><BR>this negates the need to deal with dynamic controls, which gets VERY complex when inside another control like a datagrid

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts