yes, i'm not sure how i would detect?

i don't know the syntax to say if sender = literal, do this, or if 
sender = textbox, do this. do you know raj? thanks!

public void OnDataBinding(object sender, EventArgs e)
{
  Literal lc = (Literal) sender;




--- In [EMAIL PROTECTED], "Rajendra Appalla" 
<[EMAIL PROTECTED]> wrote:
> Then may be you can check for the sender type whether it's a label 
or a
> text box.
> If it's a textbox, then write code appropriate to that.  
> May be this will work.  Hard part would be trying to find out 
whether
> it's a label or a textbox.
>  
> Please let me know after you try it or find a solution to this 
issue.
> Thanks.
>  
> Raj.
>  
> -----Original Message-----
> From: Trevor Thompson [mailto:[EMAIL PROTECTED] 
> Sent: Monday, July 26, 2004 5:00 PM
> To: [EMAIL PROTECTED]
> Subject: [AspNetAnyQuestionIsOk] Re: help w/ dynamically created
> datagrid
>  
> that doesnt work b/c as you can see in my OnDataBinding function 
> below, it is assigning the 'incoming' control as a literal. and 
when 
> it's not a literal, it bombs.
> 
> --- In [EMAIL PROTECTED], "Rajendra Appalla" 
> <[EMAIL PROTECTED]> wrote:
> > You need to check for the Item Type in the InstantiateIn method 
of 
> your
> > class.
> >  
> > Also I forgot to tell you that you need to add the following line 
> in the
> > case of EditItem after adding the textbox to the container 
similar 
> to
> > lbl in the ItemType of Item.
> >  
> > txt.DataBinding  += new EventHandler(OnDataBinding);
> >  
> > Hope this works.
> >  
> > I did not try it.
> >  
> > Raj.
> >  
> > -----Original Message-----
> > From: Rajendra Appalla 
> > Sent: Monday, July 26, 2004 4:42 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: [AspNetAnyQuestionIsOk] Re: help w/ dynamically 
created
> > datagrid
> > Importance: High
> >  
> > See this code.
> > 
> >       public void InstantiateIn(System.Web.UI.Control container)
> >             {
> >                   Label lbl = new Label();
> >                   switch(templateType)
> >                   {
> >                         case ListItemType.Header:
> >                                     lbl.Text = strTableLabel;
> >                                     container.Controls.Add(lbl);
> >                                     break;
> >                         case ListItemType.Item:
> >                               lbl.Text = strColumnName;
> >                               container.Controls.Add(lbl);
> >                               lbl.DataBinding += new
> > EventHandler(OnDataBinding);
> >                               break;
> >                         case ListItemType.EditItem:
> >                               TextBox txt = new TextBox();
> >                               txt.Text = strColumnName;
> >                               container.Controls.Add(txt);
> >                               break;
> >                         case ListItemType.Footer:
> >                               lbl.Text = "<I>" + strColumnName 
> + "</I>";
> >                               container.Controls.Add(lbl);
> >                               break;
> >                   }
> >             }
> > 
> > Raj.
> > 
> > -----Original Message-----
> > From: Trevor Thompson [mailto:[EMAIL PROTECTED] 
> > Sent: Monday, July 26, 2004 4:44 PM
> > To: [EMAIL PROTECTED]
> > Subject: [AspNetAnyQuestionIsOk] Re: help w/ dynamically created
> > datagrid
> > 
> > well it's not really 'convoluted'. i needed a way in which i 
could 
> > dynamically add template columns. i cannot have auto-generated 
> > columns. also, the example does not show anything about my 
original 
> > question in regards to having my data show up in a textbox. i 
need 
> to 
> > figure out how to have my data show up in a textbox. thanks!
> > 
> > --- In [EMAIL PROTECTED], "Charles M. 
Carroll" 
> > <[EMAIL PROTECTED]> wrote:
> > > well that is sort of a convoluted way ....
> > > 
> > > look at:
> > > http://www.learnasp.com/freebook/learn/cs_xmltodataset.aspx
> > > to see less convoluted example of dynamically creating 
DataGrids.
> > > 
> > > 
> > > At 03:26 PM 7/26/2004, you wrote:
> > > 
> > > >i'm having a heck of a time with my new dynamically created 
> > datagrid.
> > > >anyone willing to help out?
> > > >
> > > >i have figured out how to dynamically create a datagrid that
> > > >populates with the data that i pass through to my template 
column
> > > >using code on microsoft and dotnetbips. but now i need to 
figure 
> > out
> > > >how to make this displayed data show up inside of a textbox. 
> please
> > > >see my working code below that takes inputted column name and 
> > creates
> > > >a datagrid with the value from that column in my dataset 
showing 
> up
> > > >in the datagrid. now i just need to add a textbox with that 
> value.
> > > >
> > > >public class DataGridTemplate : ITemplate
> > > >
> > > >{
> > > >    ListItemType templateType;
> > > >    string columnName;
> > > >
> > > >    public DataGridTemplate(ListItemType type, string colname)
> > > >   {
> > > >    templateType = type;
> > > >    columnName = colname;
> > > >    }
> > > >
> > > >    public void OnDataBinding(object sender, EventArgs e)
> > > >   {
> > > >    Literal lc = (Literal) sender;
> > > >    DataGridItem container = (DataGridItem) lc.NamingContainer;
> > > >    lc.Text = ((DataRowView)container.DataItem)
> > [columnName].ToString();
> > > >    }
> > > >
> > > >    public void InstantiateIn(System.Web.UI.Control container)
> > > >    {
> > > >    Literal lc = new Literal();
> > > >    lc.DataBinding += new EventHandler(this.OnDataBinding);
> > > >    container.Controls.Add(lc);
> > > >    }
> > > >}
> > > >
> > > >
> > > >
> > > >public class edit_version_datagrid : System.Web.UI.UserControl
> > > >{
> > > >   beginning class code here...
> > > >
> > > >   //dynamically add datagrid code
> > > >   TemplateColumn tc1 = new TemplateColumn();
> > > >   tc1.ItemTemplate = new
> > > >   DataGridTemplate(ListItemType.Item, "proj_fy");
> > > >   datagrid2.Columns.Add(tc1);
> > > >   Page.Controls[1].Controls.Add(datagrid2);
> > > >   datagrid2.DataSource = MyView;
> > > >   datagrid2.DataBind();
> > > >
> > > >}
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >Yahoo! Groups Links
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >---
> > > >Incoming mail is certified Virus Free.
> > > >Checked by AVG anti-virus system (http://www.grisoft.com).
> > > >Version: 6.0.726 / Virus Database: 481 - Release Date: 
7/22/2004
> > > 
> > >   ----------
> > > 
> > > 
> > > ---
> > > Outgoing mail is certified Virus Free.
> > > Checked by AVG anti-virus system (http://www.grisoft.com).
> > > Version: 6.0.726 / Virus Database: 481 - Release Date: 7/22/2004
> > > 
> > > 
> > > [Non-text portions of this message have been removed]
> > 
> > 
> > 
> > 
> > Yahoo! Groups Sponsor
> > ADVERTISEMENT
> > click here
> > 
> 
<http://us.ard.yahoo.com/SIG=129louj7t/M=295196.4901138.6071305.300117
> 6/
> > 
> 
D=groups/S=1705006764:HM/EXP=1090961231/A=2128215/R=0/SIG=10se96mf6/*h
> tt
> > p:/companion.yahoo.com> 
> > 
> > <http://us.adserver.yahoo.com/l?
> M=295196.4901138.6071305.3001176/D=group
> > s/S=:HM/A=2128215/rand=706040144> 
> > 
> >   _____  
> > 
> > Yahoo! Groups Links
> > *         To visit your group on the web, go to:
> > http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
> >   
> > *         To unsubscribe from this group, send an email to:
> > [EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]
> subject=Unsubs
> > cribe> 
> >   
> > *         Your use of Yahoo! Groups is subject to the Yahoo! 
Terms 
> of
> > Service <http://docs.yahoo.com/info/terms/> . 
> > 
> > 
> > [Non-text portions of this message have been removed]
> > 
> > 
> > 
> > 
> > Yahoo! Groups Sponsor
> > ADVERTISEMENT
> > click here
> > 
> 
<http://us.ard.yahoo.com/SIG=129g0qq80/M=295196.4901138.6071305.300117
> 6/
> > 
> 
D=groups/S=1705006764:HM/EXP=1090961379/A=2128215/R=0/SIG=10se96mf6/*h
> tt
> > p:/companion.yahoo.com> 
> >  
> > <http://us.adserver.yahoo.com/l?
> M=295196.4901138.6071305.3001176/D=group
> > s/S=:HM/A=2128215/rand=796596623> 
> >  
> >   _____  
> > 
> > Yahoo! Groups Links
> > *         To visit your group on the web, go to:
> > http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
> >   
> > *         To unsubscribe from this group, send an email to:
> > [EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]
> subject=Unsubs
> > cribe> 
> >   
> > *         Your use of Yahoo! Groups is subject to the Yahoo! 
Terms 
> of
> > Service <http://docs.yahoo.com/info/terms/> . 
> > 
> > 
> > [Non-text portions of this message have been removed]
> 
> 
> 
> 
> Yahoo! Groups Sponsor
> ADVERTISEMENT
> click here
> 
<http://us.ard.yahoo.com/SIG=129copo1o/M=295196.4901138.6071305.300117
6/
> 
D=groups/S=1705006764:HM/EXP=1090961984/A=2128215/R=0/SIG=10se96mf6/*h
tt
> p:/companion.yahoo.com> 
>  
> <http://us.adserver.yahoo.com/l?
M=295196.4901138.6071305.3001176/D=group
> s/S=:HM/A=2128215/rand=353336567> 
>  
>   _____  
> 
> Yahoo! Groups Links
> *         To visit your group on the web, go to:
> http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
>   
> *         To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]
subject=Unsubs
> cribe> 
>   
> *         Your use of Yahoo! Groups is subject to the Yahoo! Terms 
of
> Service <http://docs.yahoo.com/info/terms/> . 
> 
> 
> [Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to