I need help badly

Discussion in 'ASP .Net' started by Sam Samnah, Jun 27, 2005.

  1. Sam Samnah

    Sam Samnah Guest

    I am building a custome control and I need to access the information in the
    hidden field (HtmlInputHidden HIH) so that when a button is pressed the
    information in the hidden fields value is returned. Somehow, when the
    submit button is pressed the value in the Hidden field disappears into cyber
    nothing. Please help. This application is supremely important to me.

    Anyhow is greatly appreciated thank you

    the code is as follows:
    public class FreeForm : WebControl, IPostBackDataHandler
    {
    HtmlGenericControl HGC;
    HtmlInputHidden HIH;
    public FreeForm(): base(HtmlTextWriterTag.Table)
    {}
    public string Text
    {
    get{return HIH.Value;}
    set{HIH.Value=value;}
    }

    protected override void OnPreRender(EventArgs e)
    {
    base.OnPreRender (e);
    if(!Page.IsClientScriptBlockRegistered("startUp"))
    {
    StringBuilder jsload=new StringBuilder();

    jsload.Append(@"Some javascript not needed here"); // information is
    transfered from the div tag to the hidden tag
    // using client side code.

    string CMSUpReg=jsload.ToString();
    Page.RegisterClientScriptBlock("startUp",CMSUpReg);
    }
    }
    protected override void CreateChildControls()
    {

    Controls.Add(new LiteralControl("<tr bgcolor='#ffffff' height='100%'
    width='100%'>"));
    Controls.Add(new LiteralControl("<td valign='top'>"));

    HIH=new HtmlInputHidden();
    HIH.Attributes.Add("value",Text);
    HIH.Attributes.Add("name",this.UniqueID);
    Controls.Add(HIH);

    HGC=new HtmlGenericControl("div");
    HGC.Attributes.Add("CONTENTEDITABLE","true");
    HGC.Attributes.Add("width","100%");
    HGC.Attributes.Add("height","100%");
    HGC.Attributes.Add("onBlur","moveCurser(" + HIH.UniqueID + ");");
    HGC.Attributes.Add("id","oDiv");
    Controls.Add(HGC);

    Controls.Add(new LiteralControl("</td>"));
    Controls.Add(new LiteralControl("</tr>"));
    base.CreateChildControls ();
    }
    #region IPostBackDataHandler Members

    public event EventHandler TextChanged;
    public void RaisePostDataChangedEvent()
    {
    onTextChanged(new EventArgs());
    }

    protected virtual void onTextChanged(EventArgs e)
    {
    if(TextChanged !=null)
    {
    TextChanged(this, e);
    }
    }
    public bool LoadPostData(string postDataKey,
    System.Collections.Specialized.NameValueCollection postCollection)
    {
    string postedValue=postCollection[postDataKey];
    string val=Text;
    if(val!=postedValue)
    {
    Text=postedValue;
    return true;
    }
    else
    {
    return false;
    }
    }

    #endregion
    }
    [ParseChildren()]
    [PersistChildren(false)]
    public class cToolRow : WebControl
    {
    public cToolCell cCell;
    public cToolRow():base(HtmlTextWriterTag.Tr)
    {}
    protected override void AddAttributesToRender(HtmlTextWriter writer)
    {
    writer.AddAttribute(HtmlTextWriterAttribute.Height,"1");
    base.AddAttributesToRender (writer);
    }
    }
    [ParseChildren()]
    [PersistChildren(false)]
    public class cToolCell : WebControl, INamingContainer
    {
    public cToolCell() : base(HtmlTextWriterTag.Td){}
    protected override void AddAttributesToRender(HtmlTextWriter writer)
    {
    base.AddAttributesToRender (writer);
    }
    }
     
    Sam Samnah, Jun 27, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?QmlsYWw=?=

    Urgent: Please need help badly

    =?Utf-8?B?QmlsYWw=?=, Feb 26, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    336
    =?Utf-8?B?QmlsYWw=?=
    Feb 28, 2004
  2. Sam Samnah

    I need help badly

    Sam Samnah, Jun 27, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    672
    Sam Samnah
    Jun 27, 2005
  3. termite12

    badly need help please

    termite12, May 1, 2007, in forum: C Programming
    Replies:
    1
    Views:
    317
    termite12
    May 1, 2007
  4. zam
    Replies:
    19
    Views:
    546
  5. Bilal

    Urgent: Please need help badly

    Bilal, Feb 26, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    129
    Sarmad Aljazrawi
    Feb 26, 2004
Loading...

Share This Page