|
Hi,
Let me enunciate a bit further that would be useful in identifying my concern.
Now the user, would enter few details on a web page and would click 'Add', the details would be orderno, date, etc etc.
The moment he clicks the add we have to display few details in a grid according to the orderno entered, this order info is being retrieved from the database.
So if the user is clicking add button 10 times 10 records should be displayed in the datagrid and all 10 times i would go the databse and get the order info.
This is the reason i created a datatable and bound it with a datagrid. when ever a new order is being added that info should be added to the datatable and finally show in a datagrid!
Hoping i was clear!
Gautham
|
|
|
|
|
HI,
Your code should look like as following.
foreach ( DataRow row in dst.Tables[0].Rows )
{
dt.ImportRow( row );
}
Try this.
I hope this will help you.
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
Chetan,
Actually i did the same thing but the following error is being thrown:
DataBinder.Eval: 'System.Data.DataRowView' does not contain a property with the name OrderId
Gautham
|
|
|
|
|
Hi,
This is not the code error. It happens because u might have given wrong column name or both of your tables dont have the same columnnames and same number of columns and the same order of columns.
Check for that once.
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
Hello to every one,
What this error means and how to solve this error...
"Control 'RequiredFieldValidator1' of type 'RequiredFieldValidator' must be placed inside a form tag with runat=server. "
|
|
|
|
|
that means you need to add this attribute (runat=server) in your control.
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
Go to the "Source" of your aspx file and add 'runat = "server"' tag to the RequiredFieldValidator. That should fix the problem.
|
|
|
|
|
The form tag missing from your code.
the RequiredFieldValidator must be inside the form tag
Like
Place your Html and valdation related code here
manojchilhate
|
|
|
|
|
|
hi
Looking for a bit of help. I have an asp.net listbox. I am wanting to manually be able to order the box by clicking a button. got everything set up but I keep getting an error saying that I can't have multiple selections on the list box when it is set as a single selection. I don't really know where I am going wrong so if anyone can help me I would most appreciate it. My code for the button click is as follows.
Protected Sub btOrderElementUp_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btOrderElementUp.Click<br />
If ltbOrderByList.Items.Count() = 0 Or ltbOrderByList.Items.Count() = 1 Then<br />
Exit Sub<br />
End If<br />
<br />
Dim liItem As ListItem<br />
Dim intItemIndex As Integer<br />
<br />
liItem = ltbOrderByList.SelectedItem<br />
intItemIndex = ltbOrderByList.SelectedIndex<br />
ltbOrderByList.Items.Insert(intItemIndex - 1, liItem)<br />
ltbOrderByList.Items.RemoveAt(intItemIndex)<br />
ltbOrderByList.ClearSelection()<br />
ltbOrderByList.SelectedIndex = intItemIndex - 1<br />
<br />
End Sub
The last two lines are my attempt to manually set the selected item so multiple items definitly aren't selected. If there is an easier way of doing this I would also appreciate it if you could tell me too!
Cheers
Ian
|
|
|
|
|
try this instead of
Senseicads wrote: ltbOrderByList.ClearSelection()
ltbOrderByList.SelectedIndex = intItemIndex - 1
ltbOrderByList.Items[ltbOrderByList.SelectedIndex].Selected = false;
ltbOrderByList.SelectedIndex = intItemIndex - 1
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
Thanks
I was able to just set the selected to true after my clearselection. Thanks for the help.
<br />
ltbOrderByList.ClearSelection()<br />
ltbOrderByList.Items(intItemIndex - 1).Selected = True
So is it not possible to use selectedIndex like I was attempting to then? The intellisense says that SelectedIndex is used to "get or set" the index of the selected item?
cheers
Ian
|
|
|
|
|
Hello To Everyone,
i want to declare a static variable in Asp.net which sholud also be a global variable.
Fr eg. i declared
static name as string
but when i declare it general section it gives me an error.
if i use public then i 'm unable to make it static variable
-- modified at 6:51 Monday 18th June, 2007
|
|
|
|
|
Create a static class
static MyClass
{
public static string _MyString;
}
you can access the above using the following:
String s = MyClass._MyString;
|
|
|
|
|
hello,
thanx but i need to code in vb..
could u help me out
|
|
|
|
|
In VB you can say "Shared" instead of "static".
|
|
|
|
|
|
Hi,
I'm toying around with an idea for a project but in order to get started I'd need to be able to access the HTML produced for an ASP.NET page from a function within that page.
Does anyone know if this is even possible - I was thinking if I wrote a custom http handler I might be able to do something along those lines....?
Cheers
Dave
|
|
|
|
|
Check for WebClient. Using this class you can get the HTML code for any webpage.
|
|
|
|
|
Is there any way you could render the page twice? Once to the output stream, once to a string variable?
"Knock me down, I'll get straight back up again, I'll come back stronger than a powered up pacman"
(Lilly Allen / Kaiser Chiefs)
|
|
|
|
|
Yes, you can do that by overriding Page.Render()[^]
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
After a bit of playing about I've decided to go a slightly different route - instead I create a new Page object in memory add an HtmlForm and then add the (now customisable list of) controls from the original form to it. I can render in memory and retrieve the HTML using the <code<rendercontrol< code=""> method.
It caught me out at first but since I've added objects to a temporary page, they get removed from the original page at the same time! A quick <code>Dictionary<Control, int> to store the index they occupy on the original form lets me add them back across at the end.
HTH
Dave
|
|
|
|
|
I keep getting this error in an app that was working just before the weekend
Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the <configuration>\<system.web>\<httpModules> section in the application configuration.
I've added a pages tag with the sessionstate set to true and i've referenced the hhtp module for the sessionstatemodule. I still can't get rid of this error.
I tries to reproduce the error or the changes needed to web.config so i created a new web app and added the following code to the default page
<pre>
if (Session.IsNewSession)
{
Session.Add("hereitis", "value");
}
</pre>
this runs without errors. Thinking that VS must have made some critical change to the config file before i ran it i looked in web.config but it still has only a few lines that aren't comments and none of them are the ones referenced in the error i get in my proper project. This leads me to believe that my problem does not lie with the web.config at all but i don't have any idea what might be causing it.
Has anyone seen or resolved this problem before?
Thanks,
Russell
|
|
|
|
|
Hi,
I am having some problem getting the value from the List Box which is the unique id for the name. It goes something like this. I got a table as this one.
tb_user
ID Name
11 John
12 Peter
13 Mike
So in the list box it will show only
Name
John
Peter
Mike
When I click on the button, it suppose to gather all the ID 1,2,3 to store it some where in the database.
I'd tried lstbox.SelectedValue[0] but this would cost it to retrieve '1' instead of '11', the first character of ID.
So my question is how can I retrieve all the IDs in my list box.
Thanks in advance.
J Liang
|
|
|
|
|
Liang,
you will have to store the Id in the list box as well. Try this:
listBox1.DataSource = somedatasource;
listBox1.DataTextField= "Name";
listBox1.DataValueField= "ID"
Now you can ask for listBox1.SelectedValue and you can get the ID for the item which is selected.
Hope that helps.
-- modified at 7:43 Monday 18th June, 2007
|
|
|
|