Click here to Skip to main content
   

ASP.NET

 
AnswerRe: WoW Slider now showing the image PinmvpSandeep Mewara5-Jan-13 21:09 
QuestionUnable to cast object of type 'System.Web.UI.LiteralControl' to type 'System.Web.UI.WebControls.TextBox Pinmemberamsedky5-Jan-13 2:00 
AnswerRe: Unable to cast object of type 'System.Web.UI.LiteralControl' to type 'System.Web.UI.WebControls.TextBox PinmvpSandeep Mewara5-Jan-13 21:24 
Questiondisplay animated image while save data to asp.net Pinmemberashraf almashhari4-Jan-13 22:46 
AnswerRe: display animated image while save data to asp.net PinmvpSandeep Mewara4-Jan-13 23:14 
QuestionAsp.net PinmemberManjunath Hegde4-Jan-13 1:41 
AnswerRe: Asp.net PinmemberRahul Rajat Singh4-Jan-13 2:04 
QuestionInsert/Update/Delete Records in Dynamic Generated Textbox/Checkbox and Loop Through All Records Pinmemberguodl3-Jan-13 11:11 
Hi,

Please enlight me how to insert/update/delete records based on generated textbox/checkbox.

I used the following code to generate the textbox/checkbox:
 
<asp:Repeater ID="myRepeater" runat="server" >
 <HeaderTemplate>
     <table >
        <thead><tr>
          <th>Terminal Tab</th>
          <th>Terminal Attributes</th>
          <th>Values
        </th></tr></thead>
        <tbody>
 </HeaderTemplate>
        
 <ItemTemplate>
          <tr>
    	      <td><%# Eval("TabName") %></td>
	      <td><%# Eval("TagName") %></td>
              <td><%# GenerateTag(Eval("Datatype"))%></td>
          </tr>
 </ItemTemplate>
 <FooterTemplate>
            </tbody>
            </table>
 </FooterTemplate>
</asp:Repeater>
 
Below is the function of GenerateTag:
 
        /// <summary>
        /// Generate tages based on data type.
        /// </summary>
        /// <param name="objDataType"></param>
        
        protected string GenerateTag(object objDataType)
        {
            String strTags = "";
 
            switch (objDataType.ToString()) {
                case "Char":
                    strTags = "<input id=tagText type=text  />";
                    break;
                case "Int":
                    strTags = "<input id=tagInt type=text  />";
                    break;
                case "Boolean":
                    strTags = "<input id=cbx type=checkbox  />";
                    break;
                default:
                    strTags = "<input id=strInput type=text />";
                    break;
            }
            return strTags;
        }
 
I use the following SQL statement in myRepeater:
 
           string strSQL = @"
        Select       T.ID
                              , T.TabID  TabID
                              , Tab.Name TabName
                              , T.TagName
                              , T.AppID
                              , T.DataType
                              , T.MinLen
                              , T.MaxLen
                              , A.Name AppName
                              , T.Description
         From TerminalAttrTag T 
              Left Join TerminalAttrApp A   on T.AppID = A.ID 
              Left Join TerminalAttrTab Tab on T.TabID = Tab.ID     
                 Where T.AppID = {0} or T.AppID = 1 
                               Order by T.TabID, T.SeqNo
                   ";
 
strSQL = String.Format(strSQL, AppID);
 
myRepeater.DataSource = bl.GetDataSet(ConnectionString, strSQL);
myRepeater.DataBind();
 
In screen, it shows:
 
         Terminal Tab    Attributes    Values
 
         Host Config     Host Name     (Textbox)
         Host Config     Host IP       (Textbox)
         Host Config     Timeout       (Textbox)
 
I can input below info:
 
 
         Terminal Tab    Attributes    Values
 
         Host Config     Host Name     Host Main
         Host Config     Host IP       172.1.1.1
         Host Config     Timeout       30 
 
Now I want to be able to click "Add" button to input below record (2nd records).
 
 
         Terminal Tab    Attributes    Values
 
         Host Config     Host Name     Host Backup
         Host Config     Host IP       172.2.2.2
         Host Config     Timeout       50 
 
I am thinking to use DetailsView but in the end I give up due to the dynamic generated textbox.

1. Please enlight me how I can add code in 'Add' button to insert records. Or which part of code need to be fixed or rewrite? And please advise the suitable way to handle this.

2. After problem of add/delete/update records solved, please enlight me how to loop through the records. I need to save all records to database or xml files.

Thank you for your patient.
Questionlive update PinmemberSubin Mavunkal3-Jan-13 3:23 
AnswerRe: live update PinmentorKeith Barrow3-Jan-13 3:46 
AnswerRe: live update PinmemberRahul Rajat Singh3-Jan-13 23:04 
QuestionHow to populate WoW Slider from database PinmemberJassim Rahma1-Jan-13 9:32 
QuestionUmbarco or Joomla? PinmemberJassim Rahma1-Jan-13 0:58 
AnswerRe: Umbarco or Joomla? PinmemberRahul Rajat Singh3-Jan-13 22:51 
AnswerRe: Umbarco or Joomla? Pinmemberdeflinek8-Jan-13 3:55 
QuestionSlideShow Control Pinmembercdpsource31-Dec-12 2:19 
AnswerRe: SlideShow Control Pinmemberjkirkerx31-Dec-12 11:23 
GeneralRe: SlideShow Control Pinmembercdpsource1-Jan-13 0:41 
AnswerRe: SlideShow Control Pinmemberjkirkerx1-Jan-13 11:31 
GeneralRe: SlideShow Control Pinmember@AmitGajjar1-Jan-13 7:41 
GeneralRe: SlideShow Control Pinmembercdpsource1-Jan-13 10:35 
Questioni hv registerd in free web hostin website and i create an empty website... Pinmembersyedkhaleel31-Dec-12 0:24 
AnswerRe: i hv registerd in free web hostin website and i create an empty website... Pinmember_Amy31-Dec-12 18:47 
AnswerRe: i hv registerd in free web hostin website and i create an empty website... Pinmember@AmitGajjar1-Jan-13 7:43 
Questionregistration form Pinmemberkhusali30-Dec-12 22:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web04 | 2.8.150327.1 | Last Updated 29 Mar 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid