|
What I think you're asking for is creating your py_user control dynamically, when certain conditions are met, and also, a specified number of times, which would be user-input defined.
I'm only guessing you'll be putting that number in a textbox somewhere on your page.
Either way, how you should be doing it, is:
private void CreatePyUser()
{
try
{
int pyNum = Convert.ToInt32(textBox1.Text);
for(int py_uNum=0; py_uNum<=pyNum; pu_uNum++)
{
py_user py_user1 = new py_user();
py_user1.ID = "py_user"+py_uNum.ToString();
this.Controls.Add(py_user1);
}
}
catch
{
Response.Write("Please put in a number in the given textbox.");
}
}
If that's not what you wanted, please try explaining what you need in a bit more detail.
And perhaps pass some of your own code, sometimes?
var question = (_2b || !(_2b));
|
|
|
|
|
Thanks for your quick reply but i am not able to make an object of the usercontrol ie py_user py_user1 = new py_user();
also this part i have done using
Control t = LoadControl("../UserControl/py_user.ascx");
t.ID = "py" + i.ToString();
pPanel1.Controls.Add(t);
In my user control there is a textbox that takes an integer value and generates a table with the specified no of rows,
Now what happens suppose i have created 3 instance of my usercontrol, again in the first usercontrol i want 3 rows so i put 3 and generate 3 rows till this it is working fine, but when i move to second instance of usercontrol and try to generate 2 rows it generate 2 rows but it clear the rows of first control.
i want rows in all the usercontrols, please help me..............
|
|
|
|
|
I think I know what you mean...
As I understand it, you have something like this, in the code-behind of your usercontrol:
private void CreateTable(int x)
{
HtmlTable table = new HtmlTable();
for (int y = 0; y <= x; y++)
{
HtmlTableRow tableRow = new HtmlTableRow();
table.Controls.Add(tableRow);
}
this.Controls.Add(table);
}
And this method gets called through some button click on the user control.
This is only going to govern this instance of your py_user. It will do a postback and render a table FOR THIS instance. But the remaining 4, or however many py_user controls on that page will not have had that buttonclick triggered for them and therefore they would get rendered as PURE py_user controls (no tables, no rows), if at all.
I don't like your design one bit.
Sorry there is no easy way out, without adding those controls to the Session, then checking if the session is not null.
Honestly, what are you trying to achieve through this?
var question = (_2b || !(_2b));
|
|
|
|
|
I am having two DetailsView both are in update panel,and the objective of 1stDetails view is to Add Category and the 2nd is to Add subcategory.I have used a Dropdown list to select Category in 2ndDatalist.But Failed to Rebind the dropdown list Afetr immediate Category addition. I have alredy used Updatemode=Conditional,and ScriptManager.GetCurrent(Me).RegisterPostBackControl(datalistName) as i have to Upload image for both category and SubCatecory.
Any type of help is appreciated.Thanks
|
|
|
|
|
We are designing an application in which a large number of forms with predefiend text have to be presented to the user and the user has to fill in the desired values and post it back to the application. The following 2 solutions are there in my mind :
1. We could have used directly pdf in browser and get the user entered data posted back to the application for processing.
2. Adobe Forms Server (but the S/W is not with me so can't decide on it)
The primary requirements are :
1. The user should be presented with the form in the way he should be able to print it.
2. We need to have control on whether the user can save/print the form or he cannot do so.
3. There may be a need for the form to be presented back to the user at a later stage, with the data filled in by him through an application generated ID.
Thanks,
Sundeep
|
|
|
|
|
Sundeep Moudgil wrote: We are designing an application in which a large number of forms with predefiend text have to be presented to the user and the user has to fill in the desired values and post it back to the application. The following 2 solutions are there in my mind :
1. We could have used directly pdf in browser and get the user entered data posted back to the application for processing.
2. Adobe Forms Server (but the S/W is not with me so can't decide on it)
The primary requirements are :
1. The user should be presented with the form in the way he should be able to print it.
2. We need to have control on whether the user can save/print the form or he cannot do so.
3. There may be a need for the form to be presented back to the user at a later stage, with the data filled in by him through an application generated ID.
Thanks,
Sundeep
I'm sorry. Is there a question in there?
As much as it pains me to say this, have you tried InfoPath?
I didn't get any requirements for the signature
|
|
|
|
|
Thanks for your reply.
My question is what would be the best approach in such a scenario?
I am aware of only these 2 options mentioned by me :
1. We could have used directly pdf in browser and get the user entered data posted back to the application for processing.
2. Adobe Forms Server (but the S/W is not with me so can't decide on it)
In the first one I am not aware of how I can control the toolbars display for achieving the flexibility to programatically decide is the save / print options are to be encabled or not.
As for the second one, I have formed my understanding on the basis of whatever I have read, but have never used it and since I don't have this S/W so can't clearly decide if that will be the recommended solution.
Of these 2 approaches is there a better approach also?
Also for option 1 , how can I achieve the flexibity that is required ?
I have not used InfoPath..
|
|
|
|
|
Hello all,
I am searching for control which control is more faster to display data from database.
currently I am using repeater control and data grid view.
and some time I get data with help SqlCommand and Sql addapter I though it is more fast.
If I create a custom control and use response.Write it will fast?
If you have any suggestion than please share with me.
Regards
|
|
|
|
|
Data Adapters are slow, databinding is slow, data binding using DataBinder.Eval is really slow.
Get the data via a Data Reader, stuff it into a custom object, and then render the page using a repeater control without using DataBinder.Eval and I think you will notice a fair, maintainable improvement.
Also, how much data are you trying to display? Retrieve the smallest amount possible for the given screen and rendering only the required elements is another avenue for speed improvements.
|
|
|
|
|
Your main bottleneck will probably not be the repeater, response.write or gridview.
If you can, cache the data. I wrote an article with an easy way to do that http://www.codeproject.com/KB/aspnet/LookUpDataCache.aspx[^]
You main bottleneck will probably be the SQL query, not the serialization of the data.
Also, if you use the repeater or gridview's itemdatabound event that will be faster than setting the data in the mark up. Because the mark up has to use reflection to get the data type.
I didn't get any requirements for the signature
|
|
|
|
|
Iam using Vb through excel.
iam using K-means clistering for segmenation using one parameter( diatance).
please hekp me .
thanks in advance.
|
|
|
|
|
Dear All,
iam having an application in which there are Asp.net and Classic Asp pages
i have created two Session variables one for Asp.net and other for Classic Asp
i have set session time out of 2 mins in IIS setting
now i check the Session fot both Asp .net and Asp but after the Define time interval dotnet session expire but classic Asp session is alive
can u help me out of the Problem
My classic Asp session is not getting expire after define time interval
|
|
|
|
|
Hi,
I have written the code for display popup window using javascript in button onclient click event.
<asp:button id="Button1" runat="server" style="position: static" onclientclick="openwindow()" xmlns:asp="#unknown">
Text="Execute"/>
function openwindow()
{
window.open("AssignedTickets.aspx",'window','width=630,height=620,background=silver,menubar=no, resizable=no')
}
And I want to pass parameters to that popup page because there are some search parameters i need to pass those to popup page and display the results in popup page.
Please anybody help me how pass parameters using javascript.
Thanks in Advance
Pavani
|
|
|
|
|
pavanip wrote:
function openwindow()
{
window.open("AssignedTickets.aspx",'window','width=630,height=620,background=silver,menubar=no, resizable=no')
}
Adding parameters to the querystring would be a clean way of doing it, though it has its disadvantages.
Do:
function openwindow()
{
window.open("AssignedTickets.aspx?Param1=Something¶m2=somethingother",'window','width=630,height=620,background=silver,menubar=no, resizable=no')
}
Then in the code behind of AssignedTickets you can access these with:
string param1 = Request.QueryString["param1"];
var question = (_2b || !(_2b));
|
|
|
|
|
thanks for your response. I am trying with that code. But my values are in textboxes. can you tll me exact syntax to assign textbox values to param1 ans param2?
|
|
|
|
|
Oh, man...
var param1 = document.getElementById('textBox1').value;
obviously it doesnt have to be called param1.
Please read up on javascript, seems like you need it.
Good luck.
var question = (_2b || !(_2b));
|
|
|
|
|
I used this statement to pass values
var param1 = document.getElementById('textBox1').value;
but it dost not passing anything i am getting null value.
|
|
|
|
|
Oh, come on.
it's not my fault your control does not have any text in it.
Where are you declaring the param1 variable, anyway?
Where are you accessing it from?
Is your control's ID textBox1 ?
Either put some more code out here or google for it and figure it out yourself.
I really do recommend the latter, too.
var question = (_2b || !(_2b));
|
|
|
|
|
i have written a code for login control but it generate the following error
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0161: 'ASP.login_aspx.SiteLevelCustomAuthenticationMethod(string, string)': not all code paths return a value
Source Error:
[No relevant source lines]
Source File: Line: 0
Microsoft (R) Visual C# 2008 Compiler version 3.5.21022.8
for Microsoft (R) .NET Framework version 3.5
Copyright (C) Microsoft Corporation. All rights reserved.
e:\New Folder (2)\WebApplication1\WebApplication1\login.aspx(15,14): error CS0161: 'ASP.login_aspx.SiteLevelCustomAuthenticationMethod(string, string)': not all code paths return a value
the code is
database name pubs and table name pswd
where columns are User and pswd
]]>
]]>
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
bool Authenticated = false;
Authenticated = SiteLevelCustomAuthenticationMethod(Login1.UserName, Login1.Password);
e.Authenticated = Authenticated;
if (Authenticated == true)
{
//Response.Redirect();
}
}
private bool SiteLevelCustomAuthenticationMethod(string UserName, string Password)
{
SqlCommand cmdSelect;
bool boolReturnValue = false;
string strConnection = "@Server=localhost;Integrated Security=SSPI; Database=Pubs";
SqlConnection Connection = new SqlConnection(strConnection);
cmdSelect = new SqlCommand( "Select * From pswd", Connection );
SqlDataReader Dr;
Connection.Open();
Dr = cmdSelect.ExecuteReader();
while (Dr.Read())
{
if ((UserName == Dr["user"].ToString()) & (Password == Dr["Pswd"].ToString()))
{
boolReturnValue = true;
}
Dr.Close();
return boolReturnValue;
}
}
<asp:login id="Login1" runat="server" onauthenticate="Login1_Authenticate" xmlns:asp="#unknown">
|
|
|
|
|
rosae619 wrote: 'ASP.login_aspx.SiteLevelCustomAuthenticationMethod(string, string)': not all code paths return a value
Doesn't this say that SiteLevelCustomAuthenticationMethod is not returning something when it should ?
rosae619 wrote: while (Dr.Read())
{
if ((UserName == Dr["user"].ToString()) & (Password == Dr["Pswd"].ToString()))
{
boolReturnValue = true;
}
Dr.Close();
return boolReturnValue;
}
You have closed the while loop at wrong place.
|
|
|
|
|
Hi,
I'm new in ASP.NET and need some help with my problem. I need to convert some HTML tags to Microsoft Office Word 2003's XML format. Is there any built-in component from .NET that can do this?
Thanks in advance for your help.
|
|
|
|
|
All,
I am looking for a mechanism which makes use of "Forms authentication" and "Role based authorization".
Requirement is
my application should validate users belonging to different groups "Admin,guest,developer" and each group may consist of no of users.
for ex: if i(developer) logs in with my id and pwd i should be redirected to web pages that are specific to me, likewise for admin and guest too.
i am considering option of storing credentials in sessions and fetch the roles from db for access.
Is this a feasible option.
can anyone guide me?
Thanks
Mukkanti
|
|
|
|
|
Look up bitmasking, it will be of great help for you.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
hi can you be more specific plz..
Thanks
Mukkanti
|
|
|
|
|
Hello there
I'm having this registration form with 7 fields of real_name, user_name, email, password, city, webpage and signiture, I want my users to fill in this form and then after submitting the form I want to send them an activation email. my database has mentioned fields and also id (using identity) and verfy_user with default value of 0 (which means not).
2 questions are here for me:
1- how can I send activation email (simply?)
2- how can I prevent unactivate users from logging in?
your responses will be highly appriciated
Proper Prepration Prevents Poor Performance! h
|
|
|
|