C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » ASP.NET »

its very urgent


Posted Date: 19 Nov 2008      Posted By: Dhurva singh      Member Level: Silver     Points: 1   Responses: 1



1)MAKE A ASPX PAGE AND PASTE IT
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<script language="javascript" type="text/javascript">
function setFocus(j)
{
document.getElementById('Name'+j).focus();
}
var i = 1;
function Create()
{
createTextbox.innerHTML = createTextbox.innerHTML +"<input type=text name='Name"+i+"' />"
document.getElementById('hdcount').value=i;
i=i+1;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:TreeView ID="TreeView2" runat="server" ExpandDepth="1" Width="30%">
<Nodes>
<asp:TreeNode Text="Master" Value="Master">
<asp:TreeNode NavigateUrl="~/Master/mastercountry.aspx" Text="Country" Value="Country">
</asp:TreeNode>
</asp:TreeNode>
</Nodes>
</asp:TreeView>
<asp:TextBox ID="txtName" runat="server"></asp:TextBox><asp:LinkButton ID="LinkButton1" runat="server" OnClientClick="Create();return false;">addmore</asp:LinkButton>
<asp:HiddenField ID="hdcount" runat="server" />
<asp:Button ID="Save" runat="server" BackColor="#400000" ForeColor="White" OnClick="Save_Click"
Text="Button" /> <div id="createTextbox">
</div> </form>
</body>
</html>
2)in cs page paste in save button click
System.Text.StringBuilder strName = new System.Text.StringBuilder();

strName.Append(txtName.Text + ",");
if (int.Parse(hdcount.Value) >= 0)
{
for (int i = 1; i <= int.Parse(hdcount.Value); i++)
{
strName.Append(Request.Form["Name" + i].ToString() + ",");
}
}


string name = strName.ToString();//ur all names with dynamic values
Response.Write("satyendra");
}
click add more thn fill submit 1 error generate whn u delete tree contron thn page execute successfully why pls chk this erro which is coming with tree control pls do correct code





Responses

Author: Pavani    19 Nov 2008Member Level: GoldRating: 2 out of 52 out of 5     Points: 6

Hi

First when I copied your application as you specified, it was giving error at the following line:

if (int.Parse(hdcount.Value) >= 0)

I couldn't get the logic exactly and what input must be given in the textbox and what will contain in the hidden field.

The error is because, initially hidden value doesn't have any value and you are trying to compare it. So first hidden field must be assigned some value.

Sorry I couldn't help you much about it... but if the you are also getting the error at same line as specified above, then you are getting it because of null value in the hidden field.

Regards,
Pavani.



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : Calling web service from Client side .net 3.0 web application
Previous : convert html to pdf in C#.net free dll or code pls
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use