--------------------- ASPX CODE ------------------------------ --------
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="dynamictxtboxex. aspx.vb" Inherits="dynamictxtboxex" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/ DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/ xhtml" >
<head runat="server">
<title>Untitled Page</title><script type="text/javascript" >function GetAlert(txtDynamic) {if(document.getElementById( txtDynamic).value!="")alert(document.getElementById( txtDynamic).value);
}
function GetPostBack(txtDynamic) {if (window.event.keyCode == 13) {document.getElementById("htxtBox").value = txtDynamic;document.form1.submit();
}
}
</script></head><body><form id="form1" runat="server"><input type="hidden" id="htxtBox" runat="server" value=""/><div><asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHold er></div></form></body></html>
------------------------------ ---------- VB CODE ------------------------------ -
PartialClass dynamictxtboxexInherits System.Web.UI.PageDim Tbl As TableDim tblCell As TableCellDim tblRow As TableRowDim txtDynamic As TextBox
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LoadIf Not Page.IsPostBack ThenTbl =New TableTbl.Rows.Add(GetTableRow(1))
PlaceHolder1.Controls.Add(Tbl)
Session("DynamicTable") = TblElseTbl = Session("DynamicTable")If htxtBox.Value = "Txt" & Tbl.Rows.Count.ToString ThenTbl.Rows.Add(GetTableRow(Tbl. Rows.Count + 1))
PlaceHolder1.Controls.Add(Tbl)
htxtBox.Value =""ElsePlaceHolder1.Controls.Add( Session("DynamicTable"))End IfEnd IfEnd SubPublic Function GetTableRow(ByVal Count As String) As TableRowtxtDynamic =New TextBoxtxtDynamic.ID ="Txt" & CounttxtDynamic.Attributes.Add("onmousedown", "GetAlert('" & "Txt" & Count & "')")txtDynamic.Attributes.Add("onkeydown", "GetPostBack('" & "Txt" & Count & "')")tblRow =New TableRowtblCell =New TableCelltblCell.Text ="Enter value for " & CounttblRow.Cells.Add(tblCell)
tblCell =New TableCelltblCell.Controls.Add( txtDynamic)
tblRow.Cells.Add(tblCell)
Return tblRowEnd FunctionEndClass
<head runat="server">
<title>Untitled Page</title><script type="text/javascript" >function GetAlert(txtDynamic) {if(document.getElementById(
}
function GetPostBack(txtDynamic) {if (window.event.keyCode == 13) {document.getElementById("htxtBox").value = txtDynamic;document.form1.submit();
}
}
</script></head><body><form id="form1" runat="server"><input type="hidden" id="htxtBox" runat="server" value=""/><div><asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHold
------------------------------
PartialClass dynamictxtboxexInherits System.Web.UI.PageDim Tbl As TableDim tblCell As TableCellDim tblRow As TableRowDim txtDynamic As TextBox
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LoadIf Not Page.IsPostBack ThenTbl =New TableTbl.Rows.Add(GetTableRow(1))
PlaceHolder1.Controls.Add(Tbl)
Session("DynamicTable") = TblElseTbl = Session("DynamicTable")If htxtBox.Value = "Txt" & Tbl.Rows.Count.ToString ThenTbl.Rows.Add(GetTableRow(Tbl.
PlaceHolder1.Controls.Add(Tbl)
htxtBox.Value =""ElsePlaceHolder1.Controls.Add(
tblCell =New TableCelltblCell.Controls.Add(
tblRow.Cells.Add(tblCell)
Return tblRowEnd FunctionEndClass
No comments:
Post a Comment