|
If the second drop down has all the same value, minus the one selected you should be using a multi-select box instead of a select drop down. Then the user can select multiple choices w/o going back and forth between the server and w/o the complexity you're talking about.
If you're doing this to limit the number of choices the user makes, you could do this in javascript. Then on the server-side, validate the data a second time to make sure the user didn't try and bypass your client-side script.
|
|
|
|
|
Yes, the second one should have the same values except for the previously selected one. The problem is that after the first selection made with the DropDownList, the user can chose, for the selected value, properties from another DDL, and then another value for this one. So, when the user opens the page, he see a row of DDL. I need that, after the row he finish fulling it, another raw is created under the existing one, and so on, and only the mix of choises done before couldnt be re-done after...
That's the reason why I can't use a multi-select box..
I hope I explaned it well..
About javascript:i'm not used to it, do you really think I can do what I need better using javascript?
how could i do it?
Thanks anyway for the reply 
|
|
|
|
|
Sounds like I didn't understand what it is you are trying to do. To clarify, it sounds like you are trying to allow the user to fill out a row of DDL. And then AFTER they have completed that row you want to give them a new row of DDL controls, minus the value(s) from the previous row.
If this is the case, then I recommend that when the user has completed the current row you will allow them to submit those changes to the server. You could use the SelectedIndexChanged of the last DDL of the row, or a command button.
When the user submits the selected values, create a new row in your data source and then rebind your Grid or list (whichever you are using) with the updated data source.
Here's an blog post on using the GridView's footer template to insert new rows: http://geekswithblogs.net/casualjim/articles/51360.aspx[^]. Just put all your DDLs into the footer row and proceed as I recommended above.
If your data source isn't meant to actually update a database or some other persisted store, but is just transient form data for some operation then instead of updating a persisted store you can maintain the data source in a session variable until the user has completed their operation. Then clear out the session variable when you are done.
|
|
|
|
|
Sir,
I m adding texbox in grid at runtime . it added successfully
but my problem is that how to read a value in a texbox i m sending
my code plz check this code give me reply
SqlDataAdaptor da=new SqlDataAdaptor("Select * from mytable",MyConnectionString);
DataSet dtSet=new DataSet();
da.Fill(dtSet);
GridView1.DataSource=dtSet.Table[0];
GridView1.DataBind();
TextBox txt ;
string strID;
//Add Textbox in a grid
for (int i = 0; i < dtSet.Tables[0].Rows.Count; i++)
{
for (int j = 0; j < dtSet.Tables[0].Columns.Count; j++)
{
txt = new TextBox();
strID = i.ToString()+j.ToString();
txt.ID=strID;
GridView1.Rows[0].Cells[0].Controls.Add(txt);
}
}
//Read This TextBox Value
string strTextID;
for (int i = 0; i <GridView1.Rows.Count ; i++)
{
for(int j=0;j<GridView1.Columns.Count;j++)
{
strTextID=i.ToString()+j.ToString();
TextBox txt = (TextBox)GridView1.Rows[i].Cells[j].FindControl(strTextID);
string strText=Txt.Text;//This Statement Give me error
}
}
plz send me reply
Thanks & Regards
Lav Naphade
lav naphade
|
|
|
|
|
|
sir,
my problem is my gridview column size is not fix so i can not
add column in a template control so adding textbox in a grid at
run time .
how to add textbox in a ItemTemplate at runtime or template controlt?
plz sir give me proper solution .
lav naphade
|
|
|
|
|
To add the control you should be using the RowDataBound event (http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowdatabound.aspx[^]) like this:
<br />
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e){<br />
if(e.Row.RowType == RowType.DataRow){<br />
txt = new TextBox();<br />
strID = "textBox1";<br />
txt.ID=strID; <br />
<br />
e.Row.Cells(1).Controls.Add(txt)<br />
}<br />
}<br />
Try recursively searching the result of : GridView1.Rows[i].Cells[j]. Instead of calling
GridView1.Rows[i].Cells[j].FindControl(strTextId). Do a recursive search of each of the child controls like this:
<br />
Control ctrl = GridView1.Rows[i].Cells[j];<br />
<br />
TextBox txt = FindControlRecursive(ctrl, strTextId) as TextBox;<br />
if(txt != null){<br />
}<br />
Where your recursive function looks like this:
<br />
private Control FindControlRecursive(Control current, String textId){<br />
Control result = current.FindControl(textId);<br />
if(result != null)<br />
return result;<br />
<br />
foreach(Control ctrl in current.Controls){<br />
result = FindControlRecursive(ctrl, textId)<br />
if(result != null)<br />
return result;<br />
}<br />
<br />
return null;<br />
}<br />
|
|
|
|
|
I nested a repeater inside a gridview templateField, this works fine, the problem is now the gridview width will not expand when the page is expanded.
Prior to this I had nested gridviews and the parent gridview's width expanded with the page. Is there a workaround to get the parent grid to expand with a nested repeater?
|
|
|
|
|
Hello everybody,
I read the excellent article about inserting a captcha control in a webpage, located here[^].
I liked so much the idea, that I wanted to extend the standard Login webcontrol which comes with ASP.NET 2.0, by adding a captcha image to be read and its content typed into a textbox.
The solution I found in the article uses the Page Session to generate an unique ID, that is then compared to what the user types.
My problem is that when I try to implement the very same solution in the webcontrol, I cannot access the Page object at all! It's like I cannot retrieve the page object my new webcontrol refers to, from within the control itself.
Is there some workaround to access the Page property?
If not, what could I use to generate an unique ID to be compared? I was thinking of simply generating a random number, but I do not know if it's recommendable.
Thanks in advance
Rey9999
~~~ From Milano to The Hague, easy as it goes ~~~
|
|
|
|
|
Rather than creating your own user control, couldn't use the login control template to include the captcha?
only two letters away from being an asset
|
|
|
|
|
I could.. but you know, this was not something I needed done for work, it was just to see if I were still able to extend existing cotrols. I liked the "login+captcha" idea, that's all. Anyway, I went with the random number approach, not so elegant but it works.
Now I have another problem:
How can I tell the control that it first has to check the correctness of the captcha?
I tried overriding the event OnLoggingIn, but this seems to happen when the login has already taken place.
Any ideas?
Thanks in advance
Rey9999
~~~ From Milano to The Hague, easy as it goes ~~~
|
|
|
|
|
The random number approach is a failure: since the page seems to reload the control after the loggingin procedure, I cannot have a unique identifier for each login attempt, beside the page session.
But how can I access it from the webcontrol itself?
Any help would be much appreciated. Thank you.
Rey9999
~~~ From Milano to The Hague, easy as it goes ~~~
|
|
|
|
|
Hi, I would like to ask for help for one simple issue. I am a beginner in ASP.NEt and I would like to put the data from the textbox in database. So, I have a textbox and a button and a Sql Server DB, and I tried different things but nothing didn't work. I would really like to know how this simple thing is going, and I know that it can be done for 5 min, so if some one have a spare 5 min to spend on that kind of project, and attach a source code from the project, I would really appreciated. Thanks ahead
|
|
|
|
|
have you created any code yet, can we see it?
this is an example using stored procedure:
SqlCommand cmd_insertintotable = new SqlCommand("insertintotable", con4);
cmd_insertintotable.CommandType = CommandType.StoredProcedure;
cmd_insertintotable.ExecuteNonQuery();
cmd_insertintotable.Parameters.Add(new SqlParameter("@textboxvalue", SqlDbType.VarChar));
cmd_insertintotable.Parameters["@textboxvaluecode"].Value = textboxvalue.text;
here is the actual stored procedure which you should have in sql server:
CREATE Procedure insertintotable
(
@field varchar (30),
)
AS
INSERT INTO table
(field )
VALUES
(@textboxvalue)
this should get you going, remember you need an sql connection as well but you can do some work! 
|
|
|
|
|
.netman wrote: CREATE Procedure insertintotable
(
@field varchar (30),
)
AS
INSERT INTO table
(field )
VALUES
(@textboxvalue)
that should be
CREATE Procedure insertintotable
(
@textboxvalue varchar (30)
)
AS
INSERT INTO table
(field )
VALUES
(@textboxvalue)
|
|
|
|
|
Hi,
I'm using ASP.NET 2.0 C# on a website with some pages using HTTPS with an SSL cert from VeriSign. The C# redirects any required page to use HTTPS.
However in Firefox I get the "Connection Partially Encrypted" warning and padlock with line through it and IE gives the "This page contains unencrypted items" warning.
As far as I can see it the generated link WebResource.axd that is not going through the SSL as its jumping to the root with no https reference:
Disabling Javascript on the Browser allows the page to become fully
secure (no red line in the padlock).
Any ideas of how to prevent this as it now appears our site is not secure despinte having an expensive certificate?
Sam
modified on Friday, March 28, 2008 11:35 AM
|
|
|
|
|
Hi,
I have a website developed using Forms Authentication with the SqlMembershipProvider.
The host has set Medium Trust Level, which results in reflection being disabled.
When I access the page that has the login control, I get the following security exception:
System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
I have dug into some information about forms authentication in ASP.NET 2.0, and as far as I can find out, forms authentication uses reflection to determine the provider to use.
The website is currently running on a webserver that does allow reflection, but I have to move to another provider because of several issues. Almost every hosting provider uses the medium trust level on their shared services. We do not want a dedicated server (too expensive and not necessary).
This is a snippet from the web.config where I set the membership provider and the profile.
<membership defaultProvider="ArtistSqlMembershipProvider" userIsOnlineTimeWindow="30"><br />
<providers><br />
<remove name="AspNetSqlMembershipProvider"/><br />
<add name="ArtistSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="/" requiresUniqueEmail="true" passwordFormat="Hashed" maxInvalidPasswordAttempts="3" minRequiredPasswordLength="4" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="30" passwordStrengthRegularExpression=""/><br />
</providers><br />
</membership><br />
<profile defaultProvider="AspNetSqlProfileProvider"><br />
<properties><br />
<group name="Personal"><br />
<add name="FullName" type="System.String" serializeAs="String" allowAnonymous="false"/><br />
<add name="AddressLine1" type="System.String" serializeAs="String" allowAnonymous="false"/><br />
<add name="AddressLine2" type="System.String" serializeAs="String" allowAnonymous="false"/><br />
<add name="AddressLine3" type="System.String" serializeAs="String" allowAnonymous="false"/><br />
<add name="Country" type="System.String" serializeAs="String" allowAnonymous="false"/><br />
<add name="PhoneNumber" type="System.String" serializeAs="String" allowAnonymous="false"/><br />
</group><br />
<group name="Privacy"><br />
<add name="ShowEmail" type="bool" serializeAs="Binary" allowAnonymous="false"/><br />
<add name="ShowAddress" type="bool" serializeAs="Binary" allowAnonymous="false"/><br />
<add name="ShowPhoneNumber" type="bool" serializeAs="Binary" allowAnonymous="false"/><br />
</group><br />
<group name="Authorization"><br />
<add name="AdminRights" type="System.Collections.Specialized.StringCollection" serializeAs="Binary" allowAnonymous="false"/><br />
</group><br />
<group name="Activity"><br />
<add name="AdminCurrentVisit" type="System.DateTime" serializeAs="String" allowAnonymous="false"/><br />
<add name="AdminPreviousVisit" type="System.DateTime" serializeAs="String" allowAnonymous="false"/><br />
<add name="PublicCurrentVisit" type="System.DateTime" serializeAs="String" allowAnonymous="false"/><br />
<add name="PublicPreviousVisit" type="System.DateTime" serializeAs="String" allowAnonymous="false"/><br />
<add name="IPAddresses" type="System.Collections.Specialized.StringCollection" serializeAs="Binary" allowAnonymous="false"/><br />
</group><br />
<group name="Notification"><br />
<add name="TradesSalesDigest" type="bool" serializeAs="Binary" allowAnonymous="false"/><br />
<add name="ForumDigest" type="bool" serializeAs="Binary" allowAnonymous="false"/><br />
</group><br />
</properties><br />
</profile><br />
How can I resolve this?? Should I use another way of providing the forms authentication (and thus write the entire handling of the users myself)?? Can I come around the reflection another way??
modified on Sunday, March 30, 2008 5:33 AM
|
|
|
|
|
I have a web app that runs a bunch of SSRS reports in the background, i settled on running each reports (up to 30 ata time ) on different threads, and it runs lightning fast, generating all of them almost simultaneously. Then i was asked to display the results (namely success or failure, and if failure, what caused it) to the page. my question is, is it possible, and if so how do I write the results from the threads to a page while they run.
I have run loops in the past and used Response.Flush() after Response.Write() to display the results, but things start to get hairy when using multiple threads.
Any ideas?
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
Well I think the first thing to do is to synchronize the output. I assume you some class that is controlling all the threads. This class should compile the results. Then your page can get the information through a web service you call client side. You can use the output to update your we b page. Or perhaps another option would be to implement the ICallbackEventHandler interface and have some client side code on a timer.
modified on Friday, March 28, 2008 12:07 PM
|
|
|
|
|
Hello ,
I want to know how can I make a call to a webmethod with a private key and certificate. I mean the server expect the webmethod to send messagedigest with the web method call.
Please suggest.
Regards,
Pavas
|
|
|
|
|
In my Web.config file,authentication mode is "Form" and login url is "Login.aspx" which is in root directory.when i am calling a page which is in sub directory,then my page should automatically redirect to "Login.aspx" for authentication.but my problem is that instead of redirecting the page to "login.aspx" in root directory it searches in the same sub directory hence it does not get a file.
But when i am working offline ie on local PC,i don't get this problem.when i have uploaded this project on server i face this problem. Thank u.
coolsatty
|
|
|
|
|
I think you may need to specify the entire path of where your login.aspx page is rather then just ~/login.aspx
|
|
|
|
|
I tried putting entire path but it still searches in sub directory.Is there any settings in IIS because here in my PC its working fine but at server(handled by third party)side i am getting this problem.
coolsatty
|
|
|
|
|
I believe your problem is a result of your file path being relative. Ensure that your configuration references the file from the website root. In your case, ~/login.aspx should work.
Hope that helps.
--Jesse "... the internet's just a big porn library with some useful articles stuck in." - Rob Rodi
|
|
|
|
|
Hi,
Try "~/Login.aspx".
Faraz Shah Khan
MCP, MCAD.Net
Blog
|
|
|
|