title: How to use .Net controls with HTMLTEXTWRITER
body: <p>The code mentioned below is part of my webpart on sharepoint 2010.</p>
  
  <pre><code>public class class1 : System.Web.UI.WebControls.WebParts.WebPart
      { 
  protected override void Render(HtmlTextWriter writer)
          {
              string s1 = "first";
              string s2 = "second";
              string s3 = "third";
  
              slist.Add("first");
              slist.Add("second");
              LinkButton b;
  
              writer.Write("&lt;div id='tblSegment' &gt;&lt;table &gt;");
              foreach (string s in slist)
              {
                  //b = new LinkButton();
                  //b.Text = s;
                  //b.Click += (sender1, e1) =&gt; { b_Click(sender, e, s1, s2, s3); };
                  writer.Write("&lt;tr&gt;&lt;td &gt;");
                  writer.Write("&lt;a href=''  &gt;");
                  writer.Write(s + "&lt;/a&gt;");
                  writer.Write("&lt;/td&gt;&lt;/tr&gt;");
              }
              writer.Write("&lt;/table&gt;&lt;/div&gt;");
          }
          void b_Click(object sender, EventArgs e, string s1, string s2, string s3)
          {
              UpdateList(s1,s2,s3);
          }
      public void UpdateList(string ID, string column, string value)
          {
              using (SPSite oSPsite = new SPSite("http://server"))
              {
                  using (SPWeb oSPWeb = oSPsite.OpenWeb())
                  {
                      oSPWeb.AllowUnsafeUpdates = true;
                      // Fetch the List
                      SPList list = oSPWeb.Lists["UserProfiles"];
                      //create Query
                      SPQuery query = new SPQuery();
                      query.Query = string.Concat(
                                     "&lt;Where&gt;&lt;Eq&gt;",
                                        "&lt;FieldRef Name='ID'/&gt;",
                                        "&lt;Value Type='String'&gt;" + ID + "&lt;/Value&gt;",
                                     "&lt;/Eq&gt;&lt;/Where&gt;");
                      //get List Item
                      SPListItemCollection listItems = list.GetItems(query);
                      SPListItem item = listItems[0];
  
                      //update List Item
                      item[column] = value;
                      item.Update();
                      oSPWeb.AllowUnsafeUpdates = false;
                  }
              }
          }
  }
  </code></pre>
  
  <p>I am kind of stuck here, what i need to do is to update a sharepoint list item based on some values(s1,s2,s3), for which i have created method UpdateList.
  I need to call UpdateList method whenever any hyperlink is clicked.
  I tried to use link buttons but as expected they did not worked(commented) with htmltextwriter, so i added two simple anchor tags.
  But how to fire the click event now.</p>
  
  <p>I read about system.web.services but unable to make it work.
  The only option i can think of now is to create a seprate web service with method <code>UpdateList</code> in it kind of thing and make a ajax call to it.</p>
  
  <p>Can any body suggest something else or is it somhow possible to use ASP.Net colrols(eg LinkButton) with <code>Htmltextwriter</code>.</p>