|
public partial class test : System.Web.UI.Page
{
LiteralControl LCT1, LCT2;
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack)
{
if (txtbox.Text != "")
{
}
}
}
private void CreateControl()
{
for (int i = 0; i <= Convert.ToInt32(txtbox.Text) - 1; i++)
{
LCT1 = new LiteralControl();
LCT1.Text = "<br/>";
TextBox txt_box = new TextBox();
txt_box.ID = "txt" + "" + i.ToString();
PH1.Controls.Add(LCT1);
PH1.Controls.Add(txt_box);
//////////////////////
LCT2 = new LiteralControl();
LCT2.Text = "<br/>";
TextBox text_box = new TextBox();
text_box.ID = "txt_" + i.ToString();
PH2.Controls.Add(LCT2);
PH2.Controls.Add(text_box);
}
}
protected void Button1_Click(object sender, EventArgs e)
{
CreateControl();
}
protected void Save_Click(object sender, EventArgs e)
{
//Now here i want to insert value in Database from my textboxes which is created in PH1 and PH2
}
|
|
|
|
|
Heard about viewstate ? ASP.NET will not maintain viewstate for controls created on page_load . Read about ASP.NET page life cycle.
|
|
|
|
|
I need to find the width of the letter which i am using to create image in which it will be there as word.
|
|
|
|
|
Reposting the same question so soon only irritates people.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
on button click only i want the requiredfieldvalidator should fire, how can i do these in asp.net
|
|
|
|
|
Hi I am new in programming. Currently I involved in developing a website for a company. I use microsoft visual studio 2008 to create my website. I wish to add modules to ease my job to track the bug and store the exception in a text pad. As I know for window based application and web application are able to create a module and use in page. Is it possible to do in a website?
i add a class in my App_Code, when i want to call the method in the class, it show the blue line under my text. When i mouse over my text, it show "Reference to a non-shared member requires an object reference."
Need help
|
|
|
|
|
Hi,
i'm just guessing but are you trying to access your code without an instance of the class? If you want to do so, you have to options. Create an instance using the new-keyword or declare all methods in your class static so that you don't need an instance.
Please be so kind to post your code (the underlined one, and the one you are trying to access). This will help us to solve your problem.
Regards
Sebastian
|
|
|
|
|
Hi Sebastian,
Thanks for your help. I had solved my problem, where I forgot to put "shared" in my public sub in the class file.
Public Class Msecurity
Public Shared Sub UpdateEvent(ByVal [text] As String)
Regards,
alyy0406
|
|
|
|
|
I have very typical problem in role based authorization.
i have three roles , role1, role2, role3
and three pages , role1.aspx, role2.aspx, role3.aspx
now any person who is in role1 should not be able to see pages of role2 and role3, if he is not assigned to them. Even if he types in url :http://www.<someaddress>/role2.aspx or role3.aspx
he should be redirected to error page,
how i define this rule in web.config in windows authentication
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
I am trying to pass xml data with its schema from VB.Net to a javascript function (as a parameter) in string format.But i keep having this error 'Unterminated string constant'. Can someone help me how can i pass XMl data as string to javascript funtions from VB.Net please? Thanks
|
|
|
|
|
jonhbt wrote: 'Unterminated string constant'
Which means your string is not ended properly. HTML content will have single quote(' ) symbol and JS will think it as an end of line. So you need to replace single quote(' ) with '' . This is applicable for double quotes (" ) too.
|
|
|
|
|
I dont have any quotes but skipping a line. I am replacing Chr(13) with " " but still is not working
|
|
|
|
|
|
COM interop: Is it possible to pass a ASP.net web control (say, a textbox) as a reference type variable to a COM method? If yes, how?
Thanks,
SK
|
|
|
|
|
I don't think so. What is the reason for doing that?
|
|
|
|
|
To be able to use the same COM biz object (that references VB form controls) in both legacy VB6 windows client and new ASP.Net web client.
Thanks.
|
|
|
|
|
I have a label control in content page like below:
<asp:content id="Content1" contentplaceholderid="MainContent" runat="Server" xmlns:asp="#unknown">
<asp:label id="lblMessage" text="Hello" runat="server" height="19px">
Text="" Width="160px>
Now, how can i get the reference of the label through javascript? When I tried as below, I am not getting any vaue.
var strmsg = document.getElementbyId('lblMessage').value;
I also used the generated id by seeing the View-->Source of the browser. But still I'm not getting any value? How can i resolve this? Can anybody please help? I require the value for some other operation.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
|
ASP.NET render label as a HTML span and prefix it's containers (content place holder in your case) id with it's id. Try this
var strmsg = document.getElementbyId('<% lblMessage.ClientId %>').value;
|
|
|
|
|
N a v a n e e t h wrote: var strmsg = document.getElementbyId('<% lblMessage.ClientId %>').value;
I think it should be:
var strmsg = document.getElementbyId('<%= lblMessage.ClientID %>').value
|
|
|
|
|
That's correct. I missed the = .
|
|
|
|
|
I Have One Project[Solution] Called HRMS. Under this solution two web projects one for User Side and other for Admin Side. and also different Logon Pages for these two projects. i added the following forms autentication code in the web.config file for each project. But when am compiling am getting the below mentioned error. How can i use two forms authentication for Loging differeng Logon Pages.
Solution : HRMS
Projects
Project 1[User Side] : E:\HRMS\
Web.Config
<authentication mode="Forms">
<forms name="appNameAuth" path="/" loginurl="Login.aspx" protection="All" timeout="30">
Project 2 [Admin Side]: E:\HRMS\Admin\
Web.Config
<authentication mode="Forms">
<forms name="Admin" path="~/Admin/" loginurl="~/Admin/Admin.aspx" protection="All" timeout="30">
Error 1 It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS. E:\HRMS\Admin\Web.Config
|
|
|
|
|
Is there any reason for nesting the web.config ? You will have one web.config which is in HRMS directory and another one in HRMS\Admin directory. Are you overriding anything in the second web.config ?
I'd suggest to separate it with folders rather than creating new project. You will have only one project which contains all ASPX files and one configuration file. So you will end up with a folder structure something like
Solution Directory
--HRMS
----Files
--Admin
----Admin files
--web.config Now admin will not be a separate virtual directory and I believe it will solve your problem.
|
|
|
|
|
i have control which takes tto much time to load
so i want to put tht page into cache. but accordint to different userid
my first page is user login,after login user will get same page but diffent data . so i want to put tht page in to cache, how i will do tht??
put same page in cache but according to diiferent loginid
|
|
|
|
|
Keep it in the Cache object with user id as key and reload from there for subsequent requests.
|
|
|
|
|
can u plase give me the code....i didnt get u
n where to write tht code??
|
|
|
|