|
use a dataset(i mean one ds) and populate teh dataset with the datatables you need for your dropdown boxes. You need to write a function to return teh dataset before you bind your dropdown controls with teh datatable. the binding will look like this after teh function call
ddControl1.datasource=ods("table1")
ddControl1.databind
ddControl2.datasource=ods("table2")
ddControl2.databind
ddControl3.datasource=ods("table3")
ddControl3.databind
t.aransiola
|
|
|
|
|
Hi,
Im using the membership provider in asp.net2.0 - excellent.
Ive read some chapters on this and the documentation on msdn and got everything configured how i like.
however, i would like each user to be validated/activated by email before they can use the site. Using standard methods by sending an email to the address on their account with a guid link - the account then gets activated when they click the link in the email.
While im quite happy to code this up myself im pretty surprised that there isnt any support 'out of the box'. One problem i see is that there is no 'activated' flag in the aspnet_users table. I gather i can implement this by adding my own custom fields to the profile via web.config.
Anyone have any advice or workarounds on this matter?
Thanks in advance for any contributions.
---Guy H ( ---
|
|
|
|
|
|
Thanks for your reply mark. Ive been skirting around the tables and noticed this flag in aspnet_membership.
The book ive been reading doesnt really go very deep into the membership stuff so i think maybe some more research is going to be beneficial.
---Guy H ( ---
|
|
|
|
|
Hi
The gist of my problem is that I want to bind an ASP.NET ListBox to a List< T > and have the Value field populated by a property of an object in the List and the Text field populated by the result of the call ToString() on the object in the List (the format of which is dictated by the DataTextFormatString propery of the ListBox ):
I have two classes
PersonInfo - has properties PersonId / FirstName / LastName. This class implements IFormattable allowing customized string representation of any instantiated object.
PersonInfoList which derives from List< PersonInfo > (so stores objects of type PersonInfo ).
I want to use PersonInfoList as the DataSource to a ListBox:
PersonInfoList pil = new PersonInfoList();<br />
ListBox1.DataSource = pil;<br />
ListBox1.DataTextFormatString = "{0:l, f}";
ListBox1.DataBind();
By not specifying the DataTextField or DataValue field, the IFormattable ToString() method is called on each PersonInfo object in the PersonInfoList and both the Text and Value properties are populated with [LastName], [FirstName] as expected.
The problem is that I want the Value field to contain PersonId and the Text field to contain the Person's name (formatted) as above.
If I add PersonId to the ListBox1.DataValueField and do not specify a value for ListBox1.DataTextField , the PersonId is used for both Text and Value .
The only way that I have found around this is to add a Me property the PersonInfo class:
public PersonInfo Me<br />
{<br />
get{ return this; }<br />
}
and then set
ListBox1.DataTextField = "Me";
YUCK! This produces the desired output, but there has to be a better way to do this!
Any ideas would be much appreciated.
Chris
|
|
|
|
|
Hi there,
When a control is not suitable for my need, I might think of customizing the control. So IMHO, in this case you might want to create a custom ListBox control by inheriting from the standard ListBox control and simply override the PerformDataBinding method which is where you can put your own data binding logic.
|
|
|
|
|
Hi
Thanks for the repsonse. Just strikes me as odd that this functionality isn't available out of the box (it very nearly is - just not quite.
I discovered that I can get the functionality by using Dictionary< T > with PersonId as Key and the PersonInfo object as Value (and setting DataTextField="Value" and DataValueField="Key") - but then I can't sort the output by value (as far as I can tell) which is another requirement.
Ah well - gives me a good excuse to dig into the PerformDataBinding method I guess!
Thanks again for your help.
C
|
|
|
|
|
Basically, the ListBox control inherits from the base class ListControl , when data is bound to the control the PerformDataBinding gets executed internally. And this method contains the default logic to build the items collection from the specified data source with the settings like DataTextField, DataValueField and DataTextFormatString. Fortunately, this method is overridable, so you're not happy with the default behavior, you can change it the way you want by overriding this method in your custom control.
In addition, you may consider using the generic Dictionary as you discovered only when you bind data to the control. By this I mean, you can sort data with the List generic collection, you then copy it to the Dictionary and bind it to the control. However, this step is unnecessary to me. Adding a public property like Me is also an option, but it's not really a good choice IMHO as it requires you to change your object design.
|
|
|
|
|
I agree that the Me property is less than desirable.
Interesting point about transferring it to a Dictionary prior to binding. Hadn't thought of that!
Ultimately, I'll probably just follow your advice and subclass ListBox and any other controls that I need to use this in.
As I said, it strikes me as odd that this isn't available out of the box. It's surely not that unusual a requirement to be able to use a property of an object as the Value field and the ToString() representation of that object as the Text field and to be able to acheive this via data binding.
Any way, your feedback has been most useful and has given me something to dig into. So many thanks for your time.
C
|
|
|
|
|
Hi Friends,
I want to encrypt some numeric value .. So anybody can help me providing some encryption function ... or any kind of help for encrypt a string/numeric values ...
Thanks in advance
Arindam,
|
|
|
|
|
Imports System.Security.Cryptography<br />
Imports System.IO<br />
Imports System.Text <br />
<br />
Private Shared KEY_64() As Byte = {42, 16, 93, 156, 78, 4, 218, 32}<br />
Private Shared VAL_64() As Byte = {55, 103, 246, 79, 36, 99, 167, 3}<br />
<br />
Public Shared Function Encrypt(ByVal value As String) As String<br />
Dim CryptoProvider As DESCryptoServiceProvider = New DESCryptoServiceProvider<br />
Dim ms As MemoryStream = New MemoryStream<br />
Dim cs As CryptoStream = New CryptoStream(ms, CryptoProvider.CreateEncryptor(KEY_64, VAL_64), CryptoStreamMode.Write)<br />
Dim sw As StreamWriter = New StreamWriter(cs)<br />
sw.Write(value)<br />
sw.Flush()<br />
cs.FlushFinalBlock()<br />
ms.Flush()<br />
Return Convert.ToBase64String(ms.GetBuffer, 0, ms.Length)<br />
End Function
Pathan
|
|
|
|
|
Hi there:
.NET have System.Security.Cryptography namespace to do that...
<< >>
|
|
|
|
|
|
Hi All,
I am using .net FrameWork 1.1. In FrameWork 2.0, there is Attribute "DefaultButton" in the form and Panel tag .
How can I implement this in ,net 1.1 version. Whenever the user hits the ENTER key from anywhere in the form, the form should postback to the server.
Anybody can help me reg this?
Regards,
Jay
|
|
|
|
|
|
Hi,
Is it the only way in .net 1.1? Because I am using many forms in my project. I wish to allow the user to submit the form when he hits the enter key.
The form may contains 10 text boxes. Is there any other asp.net command to to submit the form without using JS?
Regards,
Jay
|
|
|
|
|
If the Submit button is the first button on the page and there is more than one textbox then that button will be considered "Clicked" when the user hits the "Enter" key.
Cleako
|
|
|
|
|
Yes Correct. But I am having a LinkButton as a first button which causes PostBack. And I am having some more buttons also in the form. My Actual SUBMIT button is placed at the bottom of the page.
What can I do in this case?
Because some of the Text Boxes at the end of the form are NOT mandatory fields. If the user dont want to enter any data in that, then they may HIT ENTER key from any of the Text Box. At any case I want that SUBMIT button as my default button.
Regards,
Jay
|
|
|
|
|
I believe you will have to use the JS suggestion then. Like I said, it is going to look for the first "" value and submit that one. If you are required to have a button other than the "Submit" button first then this wont work for you.
I believe without having used it yet that when you set a default button in 2.0 that it is writing a script to the page or using a common Client Scripting file that it has with it that sets the default button "behind the scenes". The difference being that it provides the script where with 1.1 you do.
Cleako
|
|
|
|
|
Ok Mr.cleako, I have understood your way of achieving this. I will try it and get back to you.
Thanks
Regards,
Jay
|
|
|
|
|
Hi All,
Here i want to execute an .exe file on particular button. Plz hlep
Regards:
Suveen
|
|
|
|
|
Which side...client or server?
<< >>
|
|
|
|
|
hi,
i want to run that file at client side
|
|
|
|
|
AFAIK...Cannot run the exe file without user's permission...
<< >>
|
|
|
|
|
Don't cross post. You received an answer on the C# Forum[^]
|
|
|
|