)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
Home » Code Library » Gv (Ia.Model.Design)

Public general use code classes and xml files that we've compiled and used over the years:

ASP.NET design related support class.

    1: using System;
    2: using System.Web;
    3: using System.Xml;
    4: using System.Configuration;
    5: using System.Data;
    6: using System.Data.OleDb;
    7: using System.Data.SqlClient;
    8: using System.Web.UI;
    9: using System.Web.UI.WebControls;
   10: using System.Collections;
   11:  
   12: namespace Ia.Model.Design
   13: {
   14:     ////////////////////////////////////////////////////////////////////////////
   15:  
   16:     /// <summary publish="true">
   17:     /// ASP.NET design related support class.
   18:     /// </summary>
   19:     /// <remarks>
   20:     /// Copyright © 2008-2013 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   21:     ///
   22:     /// This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
   23:     /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   24:     ///
   25:     /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   26:     /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   27:     /// 
   28:     /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
   29:     /// 
   30:     /// Copyright notice: This notice may not be removed or altered from any source distribution.
   31:     /// </remarks>
   32:  
   33:     public class Gv
   34:     {
   35:         ////////////////////////////////////////////////////////////////////////////
   36:  
   37:         /// <summary>
   38:         ///
   39:         /// </summary>
   40:         public Gv() { }
   41:  
   42:         ////////////////////////////////////////////////////////////////////////////
   43:  
   44:         /// <summary>
   45:         ///
   46:         /// </summary>
   47:         public static void Verify()
   48:         {
   49:         }
   50:  
   51:         ////////////////////////////////////////////////////////////////////////////
   52:         ////////////////////////////////////////////////////////////////////////////
   53:     }
   54: }
   55:  
   56: ////////////////////////////////////////////////////////////////////////////
   57:  
   58: /// <summary>
   59: ///
   60: /// </summary>
   61: public class DynamicGridViewTextTemplate : ITemplate
   62: {
   63:     string _id;
   64:  
   65:     public DynamicGridViewTextTemplate(string id)
   66:     {
   67:         _id = id;
   68:     }
   69:  
   70:     public void InstantiateIn(System.Web.UI.Control container)
   71:     {
   72:         Label l = new Label();
   73:         l.ID = _id + "_l";
   74:         l.DataBinding += new EventHandler(this.l_DataBind);
   75:         container.Controls.Add(l);
   76:     }
   77:  
   78:     private void l_DataBind(Object sender, EventArgs e)
   79:     {
   80:     }
   81: }
   82:  
   83: ////////////////////////////////////////////////////////////////////////////
   84:  
   85: /// <summary>
   86: ///
   87: /// </summary>
   88: public class DynamicGridViewTextEditTemplate : ITemplate
   89: {
   90:     string _id;
   91:     DataRow _r;
   92:  
   93:     public DynamicGridViewTextEditTemplate(DataRow r)
   94:     {
   95:         _id = r["id"].ToString();
   96:         _r = r;
   97:     }
   98:  
   99:     public void InstantiateIn(System.Web.UI.Control container)
  100:     {
  101:         TextBox tb = new TextBox();
  102:         tb.ID = _id + "_update_tb";
  103:         tb.DataBinding += new EventHandler(this.tb_DataBind);
  104:  
  105:         if (_r["text_mode"] != null && _r["text_mode"].ToString().Length > 0)
  106:         {
  107:             if (_r["text_mode"].ToString().ToLower() == "multiline") tb.TextMode = TextBoxMode.MultiLine;
  108:             else if (_r["text_mode"].ToString().ToLower() == "password") tb.TextMode = TextBoxMode.Password;
  109:             else if (_r["text_mode"].ToString().ToLower() == "singleline") tb.TextMode = TextBoxMode.SingleLine;
  110:         }
  111:         if (_r["row"] != null && _r["row"].ToString().Length > 0) tb.Rows = int.Parse(_r["row"].ToString()) / 2;
  112:         if (_r["column"] != null && _r["column"].ToString().Length > 0) tb.Columns = int.Parse(_r["column"].ToString()) / 2;
  113:         if (_r["max_length"] != null && _r["max_length"].ToString().Length > 0) tb.MaxLength = int.Parse(_r["max_length"].ToString());
  114:  
  115:         container.Controls.Add(tb);
  116:     }
  117:  
  118:     private void tb_DataBind(Object sender, EventArgs e)
  119:     {
  120:     }
  121: }
  122:  
  123: ////////////////////////////////////////////////////////////////////////////
  124:  
  125: /// <summary>
  126: ///
  127: /// </summary>
  128: public class DynamicGridViewDdlTemplate : ITemplate
  129: {
  130:     string _id;
  131:  
  132:     public DynamicGridViewDdlTemplate(string id)
  133:     {
  134:         _id = id;
  135:     }
  136:  
  137:     public void InstantiateIn(System.Web.UI.Control container)
  138:     {
  139:         Label l = new Label();
  140:         l.ID = _id + "_l";
  141:         l.DataBinding += new EventHandler(this.l_DataBind);
  142:         container.Controls.Add(l);
  143:     }
  144:  
  145:     private void l_DataBind(Object sender, EventArgs e)
  146:     {
  147:     }
  148: }
  149:  
  150: ////////////////////////////////////////////////////////////////////////////
  151:  
  152: /// <summary>
  153: ///
  154: /// </summary>
  155: public class DynamicGridViewDdlEditTemplate : ITemplate
  156: {
  157:     string _id;
  158:     string _data_xpath, _data_text_field, _data_value_field;
  159:  
  160:     public DynamicGridViewDdlEditTemplate(string id, string data_xpath, string data_text_field, string data_value_field)
  161:     {
  162:         _id = id;
  163:         _data_xpath = data_xpath;
  164:         _data_text_field = data_text_field;
  165:         _data_value_field = data_value_field;
  166:     }
  167:  
  168:     public void InstantiateIn(System.Web.UI.Control container)
  169:     {
  170:         DropDownList ddl = new DropDownList();
  171:         ddl.ID = _id + "_update_ddl";
  172:         ddl.DataSourceID = _id + "_xds";
  173:         ddl.DataTextField = _data_text_field;
  174:         ddl.DataValueField = _data_value_field;
  175:         ddl.DataBinding += new EventHandler(this.ddl_DataBind);
  176:         container.Controls.Add(ddl);
  177:     }
  178:  
  179:     private void ddl_DataBind(Object sender, EventArgs e)
  180:     {
  181:     }
  182: }
  183:  
  184: ////////////////////////////////////////////////////////////////////////////
  185:  
  186: /// <summary>
  187: ///
  188: /// </summary>
  189: public class DynamicGridViewDbDdlEditTemplate : ITemplate
  190: {
  191:     string _id;
  192:     string _data_text_field, _data_value_field;
  193:     Hashtable _ht;
  194:  
  195:     public DynamicGridViewDbDdlEditTemplate(string id, Hashtable ht, string data_text_field, string data_value_field)
  196:     {
  197:         _id = id;
  198:         _data_text_field = data_text_field;
  199:         _data_value_field = data_value_field;
  200:         _ht = ht;
  201:     }
  202:  
  203:     public void InstantiateIn(System.Web.UI.Control container)
  204:     {
  205:         DropDownList ddl = new DropDownList();
  206:         ddl.ID = _id + "_update_ddl";
  207:         ddl.DataTextField = _data_text_field;
  208:         ddl.DataValueField = _data_value_field;
  209:         ddl.DataBinding += new EventHandler(this.ddl_DataBind);
  210:  
  211:         foreach (string v in _ht.Keys)
  212:         {
  213:             if (v.Contains(_id))
  214:             {
  215:                 ddl.Items.Add(new ListItem(_ht[v].ToString(), v.Replace(_id + "|", "")));
  216:             }
  217:         }
  218:  
  219:         container.Controls.Add(ddl);
  220:     }
  221:  
  222:     private void ddl_DataBind(Object sender, EventArgs e)
  223:     {
  224:     }
  225: }
  226:  
  227: ////////////////////////////////////////////////////////////////////////////
  228:  
  229: /// <summary>
  230: ///
  231: /// </summary>
  232: public class DynamicGridViewRblYesNoTemplate : ITemplate
  233: {
  234:     string _id;
  235:  
  236:     public DynamicGridViewRblYesNoTemplate(string id)
  237:     {
  238:         _id = id;
  239:     }
  240:  
  241:     public void InstantiateIn(System.Web.UI.Control container)
  242:     {
  243:         Label l = new Label();
  244:         l.ID = _id + "_l";
  245:         l.DataBinding += new EventHandler(this.l_DataBind);
  246:         container.Controls.Add(l);
  247:     }
  248:  
  249:     private void l_DataBind(Object sender, EventArgs e)
  250:     {
  251:     }
  252: }
  253:  
  254: ////////////////////////////////////////////////////////////////////////////
  255:  
  256: /// <summary>
  257: ///
  258: /// </summary>
  259: public class DynamicGridViewRblYesNoEditTemplate : ITemplate
  260: {
  261:     string _id;
  262:  
  263:     public DynamicGridViewRblYesNoEditTemplate(string id)
  264:     {
  265:         _id = id;
  266:     }
  267:  
  268:     public void InstantiateIn(System.Web.UI.Control container)
  269:     {
  270:         RadioButtonList rbl = new RadioButtonList();
  271:         rbl.ID = _id + "_update_rbl";
  272:         rbl.Items.Add(new ListItem(Ia.Model.Default.YesNo(true), "1")); // yes
  273:         rbl.Items.Add(new ListItem(Ia.Model.Default.YesNo(false), "0")); // no
  274:         rbl.DataBinding += new EventHandler(this.rbl_DataBind);
  275:         rbl.RepeatDirection = RepeatDirection.Horizontal;
  276:         rbl.CssClass = "yesno";
  277:  
  278:         container.Controls.Add(rbl);
  279:     }
  280:  
  281:     private void rbl_DataBind(Object sender, EventArgs e)
  282:     {
  283:     }
  284: }
  285:  
  286: ////////////////////////////////////////////////////////////////////////////
  287:  
  288: /// <summary>
  289: ///
  290: /// </summary>
  291: public class DynamicGridViewUrlTemplate : ITemplate
  292: {
  293:     string _id, _text, _url;
  294:  
  295:     public DynamicGridViewUrlTemplate(string id, string text, string url)
  296:     {
  297:         _id = id;
  298:         _text = text;
  299:         _url = url;
  300:     }
  301:  
  302:     public void InstantiateIn(System.Web.UI.Control container)
  303:     {
  304:         HyperLink hl = new HyperLink();
  305:         hl.ID = _id + "_hl";
  306:         hl.Text = _text;
  307:         hl.NavigateUrl = _url;
  308:         hl.DataBinding += new EventHandler(this.hl_DataBind);
  309:         container.Controls.Add(hl);
  310:     }
  311:  
  312:     private void hl_DataBind(Object sender, EventArgs e)
  313:     {
  314:     }
  315: }
  316:  
  317: ////////////////////////////////////////////////////////////////////////////
  318:  
  319: /// <summary>
  320: ///
  321: /// </summary>
  322: public class DynamicGridViewUrlEditTemplate : ITemplate
  323: {
  324:     string _id, _text, _url;
  325:  
  326:     public DynamicGridViewUrlEditTemplate(string id, string text, string url)
  327:     {
  328:         _id = id;
  329:         _text = text;
  330:         _url = url;
  331:     }
  332:  
  333:     public void InstantiateIn(System.Web.UI.Control container)
  334:     {
  335:         HyperLink hl = new HyperLink();
  336:         hl.ID = _id + "_update_hl";
  337:         hl.Text = _text;
  338:         hl.NavigateUrl = _url;
  339:         hl.DataBinding += new EventHandler(this.hl_DataBind);
  340:         container.Controls.Add(hl);
  341:     }
  342:  
  343:     private void hl_DataBind(Object sender, EventArgs e)
  344:     {
  345:     }
  346: }
  347:  
  348: ////////////////////////////////////////////////////////////////////////////
  349:  
  350: /// <summary>
  351: ///
  352: /// </summary>
  353: public class DynamicGridViewPhotoTemplate : ITemplate
  354: {
  355:     string _id;
  356:  
  357:     public DynamicGridViewPhotoTemplate(string id)
  358:     {
  359:         _id = id;
  360:     }
  361:  
  362:     public void InstantiateIn(System.Web.UI.Control container)
  363:     {
  364:         Image i = new Image();
  365:         i.ID = _id + "_i";
  366:         i.DataBinding += new EventHandler(this.i_DataBind);
  367:         container.Controls.Add(i);
  368:     }
  369:  
  370:     private void i_DataBind(Object sender, EventArgs e)
  371:     {
  372:     }
  373: }
  374:  
  375: ////////////////////////////////////////////////////////////////////////////
  376:  
  377: /// <summary>
  378: ///
  379: /// </summary>
  380: public class DynamicGridViewPhotoEditTemplate : ITemplate
  381: {
  382:     string _id;
  383:  
  384:     public DynamicGridViewPhotoEditTemplate(string id)
  385:     {
  386:         _id = id;
  387:     }
  388:  
  389:     public void InstantiateIn(System.Web.UI.Control container)
  390:     {
  391:         HyperLink hl = new HyperLink();
  392:         hl.ID = _id + "_update_hl";
  393:         hl.DataBinding += new EventHandler(this.hl_DataBind);
  394:         container.Controls.Add(hl);
  395:  
  396:         Label l = new Label();
  397:         l.ID = _id + "_update_l";
  398:         l.Text = "Click photo to update";
  399:         l.DataBinding += new EventHandler(this.l_DataBind);
  400:         container.Controls.Add(l);
  401:     }
  402:  
  403:     private void hl_DataBind(Object sender, EventArgs e)
  404:     {
  405:     }
  406:  
  407:     private void l_DataBind(Object sender, EventArgs e)
  408:     {
  409:     }
  410: }
  411:  
  412: ////////////////////////////////////////////////////////////////////////////
  413: ////////////////////////////////////////////////////////////////////////////
  414:  
  415:  
  416:  
  417:  
  418:  
  419:  
  420:  
  421:  
  422:  
  423:  
  424: /*
  425: ////////////////////////////////////////////////////////////////////////////
  426: ////////////////////////////////////////////////////////////////////////////
  427: 
  428: /// <summary>
  429: ///
  430: /// </summary>
  431: public class DynamicDetailsViewTextTemplate : ITemplate
  432: {
  433:     string _id;
  434: 
  435:     public DynamicDetailsViewTextTemplate(string id)
  436:     {
  437:         _id = id;
  438:     }
  439: 
  440:     public void InstantiateIn(System.Web.UI.Control container)
  441:     {
  442:         Label l = new Label();
  443:         l.ID = _id + "_l";
  444:         l.DataBinding += new EventHandler(this.l_DataBind);
  445:         container.Controls.Add(l);
  446:     }
  447: 
  448:     private void l_DataBind(Object sender, EventArgs e)
  449:     {
  450:         //Label l = (Label)sender;
  451:         //DetailsViewRow row = (DetailsViewRow)l.NamingContainer;
  452:         //l.Text = DataBinder.Eval(row.DataItem, _id).ToString();
  453:     }
  454: }
  455: 
  456: ////////////////////////////////////////////////////////////////////////////
  457: 
  458: /// <summary>
  459: ///
  460: /// </summary>
  461: public class DynamicDetailsViewTextEditTemplate : ITemplate
  462: {
  463:     string _id;
  464: 
  465:     public DynamicDetailsViewTextEditTemplate(string id)
  466:     {
  467:         _id = id;
  468:     }
  469: 
  470:     public void InstantiateIn(System.Web.UI.Control container)
  471:     {
  472:         TextBox tb = new TextBox();
  473:         tb.ID = _id + "_update_tb";
  474:         tb.DataBinding += new EventHandler(this.tb_DataBind);
  475:         container.Controls.Add(tb);
  476:     }
  477: 
  478:     private void tb_DataBind(Object sender, EventArgs e)
  479:     {
  480:         //TextBox tb = (TextBox)sender;
  481:         //DetailsViewRow row = (DetailsViewRow)tb.NamingContainer;
  482:         //tb.Text = DataBinder.Eval(row.DataItem, _id).ToString();
  483:     }
  484: }
  485: 
  486: ////////////////////////////////////////////////////////////////////////////
  487: 
  488: /// <summary>
  489: ///
  490: /// </summary>
  491: public class DynamicDetailsViewDdlTemplate : ITemplate
  492: {
  493:     string _id;
  494:     //string _data_xpath, _data_text_field, _data_value_field;
  495: 
  496:     public DynamicDetailsViewDdlTemplate(string id/ *, string data_xpath, string data_text_field, string data_value_field* /)
  497:     {
  498:         _id = id;
  499:         //_data_xpath = data_xpath;
  500:         //_data_text_field = data_text_field;
  501:         //_data_value_field = data_value_field;
  502:     }
  503: 
  504:     public void InstantiateIn(System.Web.UI.Control container)
  505:     {
  506:         Label l = new Label();
  507:         l.ID = _id + "_l";
  508:         l.DataBinding += new EventHandler(this.l_DataBind);
  509:         container.Controls.Add(l);
  510:     }
  511: 
  512:     private void l_DataBind(Object sender, EventArgs e)
  513:     {
  514:         /*
  515:         string s;
  516: 
  517:         Label l = (Label)sender;
  518:         DetailsViewRow row = (DetailsViewRow)l.NamingContainer;
  519: 
  520:         s = DataBinder.Eval(row.DataItem, _id).ToString();
  521: 
  522:         if (s.Length > 0) ddl.SelectedIndex = int.Parse(s);
  523:         */
  524:  
  525: /*
  526: Label l = (Label)sender;
  527: DetailsViewRow row = (DetailsViewRow)l.NamingContainer;
  528: l.Text = DataBinder.Eval(row.DataItem, _id).ToString();
  529: * /
  530: }
  531: }
  532: 
  533: ////////////////////////////////////////////////////////////////////////////
  534: 
  535: /// <summary>
  536: ///
  537: /// </summary>
  538: public class DynamicDetailsViewDdlEditTemplate : ITemplate
  539: {
  540: string _id;
  541: string _data_xpath, _data_text_field, _data_value_field;
  542: 
  543: public DynamicDetailsViewDdlEditTemplate(string id, string data_xpath, string data_text_field, string data_value_field)
  544: {
  545: _id = id;
  546: _data_xpath = data_xpath;
  547: _data_text_field = data_text_field;
  548: _data_value_field = data_value_field;
  549: }
  550: 
  551: public void InstantiateIn(System.Web.UI.Control container)
  552: {
  553: DropDownList ddl = new DropDownList();
  554: ddl.ID = _id + "_update_ddl";
  555: ddl.DataSourceID = _id + "_xds";
  556: ddl.DataTextField = _data_text_field;
  557: ddl.DataValueField = _data_value_field;
  558: ddl.DataBinding += new EventHandler(this.ddl_DataBind);
  559: container.Controls.Add(ddl);
  560: }
  561: 
  562: private void ddl_DataBind(Object sender, EventArgs e)
  563: {
  564: /*
  565: string s;
  566: 
  567: DropDownList ddl = (DropDownList)sender;
  568: DetailsViewRow row = (DetailsViewRow)ddl.NamingContainer;
  569: 
  570: s = DataBinder.Eval(row.DataItem, _id).ToString();
  571: 
  572: if (s.Length > 0)
  573: {
  574:     ddl.SelectedIndex = ddl.Items.IndexOf(ddl.Items.FindByValue(s));
  575: }
  576: * /
  577: }
  578: }
  579: 
  580: ////////////////////////////////////////////////////////////////////////////
  581: 
  582: /// <summary>
  583: ///
  584: /// </summary>
  585: public class DynamicDetailsViewDbDdlEditTemplate : ITemplate
  586: {
  587: string _id;
  588: string _data_text_field, _data_value_field;
  589: Hashtable _ht;
  590: 
  591: public DynamicDetailsViewDbDdlEditTemplate(string id, Hashtable ht, string data_text_field, string data_value_field)
  592: {
  593: _id = id;
  594: _data_text_field = data_text_field;
  595: _data_value_field = data_value_field;
  596: _ht = ht;
  597: }
  598: 
  599: public void InstantiateIn(System.Web.UI.Control container)
  600: {
  601: DropDownList ddl = new DropDownList();
  602: ddl.ID = _id + "_update_ddl";
  603: ddl.DataTextField = _data_text_field;
  604: ddl.DataValueField = _data_value_field;
  605: ddl.DataBinding += new EventHandler(this.ddl_DataBind);
  606: 
  607: foreach (string v in _ht.Keys)
  608: {
  609:     if (v.Contains(_id))
  610:     {
  611:         ddl.Items.Add(new ListItem(_ht[v].ToString(), v.Replace(_id + "|", "")));
  612:     }
  613: }
  614: 
  615: container.Controls.Add(ddl);
  616: }
  617: 
  618: private void ddl_DataBind(Object sender, EventArgs e)
  619: {
  620: /*
  621: string s;
  622: 
  623: DropDownList ddl = (DropDownList)sender;
  624: DetailsViewRow row = (DetailsViewRow)ddl.NamingContainer;
  625: 
  626: s = DataBinder.Eval(row.DataItem, _id).ToString();
  627: 
  628: if (s.Length > 0)
  629: {
  630:     ddl.SelectedIndex = ddl.Items.IndexOf(ddl.Items.FindByValue(s));
  631: }
  632: * /
  633: }
  634: }
  635: 
  636: ////////////////////////////////////////////////////////////////////////////
  637: 
  638: /// <summary>
  639: ///
  640: /// </summary>
  641: public class DynamicDetailsViewRblYesNoTemplate : ITemplate
  642: {
  643: string _id;
  644: 
  645: public DynamicDetailsViewRblYesNoTemplate(string id)
  646: {
  647: _id = id;
  648: }
  649: 
  650: public void InstantiateIn(System.Web.UI.Control container)
  651: {
  652: Label l = new Label();
  653: l.ID = _id + "_l";
  654: l.DataBinding += new EventHandler(this.l_DataBind);
  655: container.Controls.Add(l);
  656: }
  657: 
  658: private void l_DataBind(Object sender, EventArgs e)
  659: {
  660: }
  661: }
  662: 
  663: ////////////////////////////////////////////////////////////////////////////
  664: 
  665: /// <summary>
  666: ///
  667: /// </summary>
  668: public class DynamicDetailsViewRblYesNoEditTemplate : ITemplate
  669: {
  670: string _id;
  671: 
  672: public DynamicDetailsViewRblYesNoEditTemplate(string id)
  673: {
  674: _id = id;
  675: }
  676: 
  677: public void InstantiateIn(System.Web.UI.Control container)
  678: {
  679: RadioButtonList rbl = new RadioButtonList();
  680: rbl.ID = _id + "_update_rbl";
  681: rbl.DataBinding += new EventHandler(this.rbl_DataBind);
  682: container.Controls.Add(rbl);
  683: }
  684: 
  685: private void rbl_DataBind(Object sender, EventArgs e)
  686: {
  687: }
  688: }
  689: 
  690: ////////////////////////////////////////////////////////////////////////////
  691: 
  692: /// <summary>
  693: ///
  694: /// </summary>
  695: public class DynamicDetailsViewUrlTemplate : ITemplate
  696: {
  697: string _id, _text, _url;
  698: 
  699: public DynamicDetailsViewUrlTemplate(string id, string text, string url)
  700: {
  701: _id = id;
  702: _text = text;
  703: _url = url;
  704: }
  705: 
  706: public void InstantiateIn(System.Web.UI.Control container)
  707: {
  708: HyperLink hl = new HyperLink();
  709: hl.ID = _id + "_hl";
  710: hl.Text = _text;
  711: hl.NavigateUrl = _url;
  712: //hl.Target = "_blank";
  713: hl.DataBinding += new EventHandler(this.hl_DataBind);
  714: container.Controls.Add(hl);
  715: }
  716: 
  717: private void hl_DataBind(Object sender, EventArgs e)
  718: {
  719: /*
  720: HyperLink hpl = (HyperLink)sender;
  721: DetailsViewRow row = (DetailsViewRow)hpl.NamingContainer;
  722: hpl.NavigateUrl = DataBinder.Eval(row.DataItem, _idURL).ToString();
  723: hpl.Text = "<div class=\"Post\"><div class=\"PostTitle\">" + DataBinder.Eval(row.DataItem, _idText).ToString() + "</div></div>";
  724: * /
  725: }
  726: }
  727: 
  728: ////////////////////////////////////////////////////////////////////////////
  729: 
  730: /// <summary>
  731: ///
  732: /// </summary>
  733: public class DynamicDetailsViewUrlEditTemplate : ITemplate
  734: {
  735: string _id, _text, _url;
  736: 
  737: public DynamicDetailsViewUrlEditTemplate(string id, string text, string url)
  738: {
  739: _id = id;
  740: _text = text;
  741: _url = url;
  742: }
  743: 
  744: public void InstantiateIn(System.Web.UI.Control container)
  745: {
  746: HyperLink hl = new HyperLink();
  747: hl.ID = _id + "_update_hl";
  748: hl.Text = _text;
  749: hl.NavigateUrl = _url;
  750: //hl.Target = "_blank";
  751: hl.DataBinding += new EventHandler(this.hl_DataBind);
  752: container.Controls.Add(hl);
  753: 
  754: /*
  755: Literal li = new Literal();
  756: li.Text = @"<br/>";
  757: container.Controls.Add(li);
  758: */
  759:  
  760: /*
  761: // below: link to the photo editing page
  762: hl = new HyperLink();
  763: hl.ID = _id + "_update_hl";
  764: hl.Text = "Update";
  765: hl.NavigateUrl = "photo.aspx?id=" + _id;
  766: //onclick="photo('<%# DataBinder.Eval(Container.DataItem,"id").ToString() %>');return false;" href=""
  767: hl.DataBinding += new EventHandler(this.hl_DataBind);
  768: container.Controls.Add(hl);
  769: */
  770:  
  771: /*
  772: Label l = new Label();
  773: l.ID = _id + "_l";
  774: l.Text = @"<a href="""" onclick=""photo('1');return false;"">Update</a>";
  775: l.DataBinding += new EventHandler(this.hl_DataBind);
  776: container.Controls.Add(l);
  777: * /
  778: }
  779: 
  780: private void hl_DataBind(Object sender, EventArgs e)
  781: {
  782: /*
  783: HyperLink hpl = (HyperLink)sender;
  784: DetailsViewRow row = (DetailsViewRow)hpl.NamingContainer;
  785: hpl.NavigateUrl = DataBinder.Eval(row.DataItem, _idURL).ToString();
  786: hpl.Text = "<div class=\"Post\"><div class=\"PostTitle\">" + DataBinder.Eval(row.DataItem, _idText).ToString() + "</div></div>";
  787: * /
  788: }
  789: }
  790: 
  791: */
  792:  
  793: ////////////////////////////////////////////////////////////////////////////
  794: ////////////////////////////////////////////////////////////////////////////