|
|
I have a DetailsView in which I have a DropDownList in the EditItemTemplate.
I need to access the list and populate it when the Edit command is clicked on the DetailsView.
I tried the following:
<br />
protected void dvStation_ModeChanged(object sender, EventArgs e)<br />
{<br />
DetailsViewRow row = dvStation.Rows[0];<br />
DropDownList ddlStatus = (DropDownList)row.FindControl("ddlStatus");<br />
ddlStatus.DataSource = dsStatus;<br />
ddlStatus.DataTextField = "STATUS_NAME";<br />
ddlStatus.DataBind();<br />
}<br />
But its not populating my list. I also tried a SqlDataReader, did the connection and SQL, then used a while loop to populate like:
<br />
cmd = new SqlCommand(sql, conn);<br />
dr = cmd.ExecuteReader();<br />
while (dr.Read() != null)<br />
{<br />
ddlStatus.Items.Add(dr.GetString(0));<br />
}<br />
That didn't do it either...
Any ideas?
Thanks.
Ekjon
|
|
|
|
|
Do it in the prerender event of the detailsview
Ask if currentmode is editmode
If so, get the ddl and bind it
Inside the prerender event
If Me.detailsview.CurrentMode = detailsviewmode.Edit Then
''Get ddl and bind it
End If
Alexei Rodriguez
|
|
|
|
|
Hi Alex,
It worked fine, thanks.
Now, the list is populated but I want to select the item that is the current status. So, in the same prerender - I opened the connection, got the data and tried to select it.
Didn't work.
Then I tried the same thing in ItemCommand event (Occurs when a button within a DetailsView is clicked), didn't work either.
Any idea on this?
Thanks again.
Ekjon
|
|
|
|
|
It should work
Once you get the dropdownlist in the prerenderevent (Edit mode)
populate the ddl and cal DATABIND
then: dropdownlist.selectedvalue = yourvalue
It looks like all you need is to allow the user to select a value from a dropdownlist when in edit mode, and obviously, when the record enters in edit mode, show the previously selected value
If so, you can do all this automatically
Just add the ddl to the edit template (Like you already have i think), you can also set its datasource to a sqldatasource
<EditItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" SelectedValue='<%# Bind ("TestColumn") %>'>
</asp:DropDownList>
</EditItemTemplate>
Alexei Rodriguez
|
|
|
|
|
In my Project i have to add drop down selected item to datagrid on add button,nearly 10 items i have to add,so i have taken an shared datatable
and added row to that and assigned it to datagrid.
meanwhile when two users are working on the same .aspx page ,during postback the second user is getting the items added by the first user
Help me Regarding this....
|
|
|
|
|
Member 4567541 wrote: shared datatable
static in C# right ? A static member will be available to all the threads in the application domain. So all the users will get the same instance of DataTable . If you need to keep user specific data, keep it in session variables.
|
|
|
|
|
Yeah, he asked this twice, the first time, he was less clear, but I answered him the same, he voted me 1 and deleted his post. Man, that's annoying.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian Graus wrote: Man, that's annoying.
Yes, it's annoying. We take effort to help people and they will go without telling anything or leaving a "1" vote. It's really annoying. There are lot of people in IT industry who don't have any idea about the basics and working with big projects ! These might be the reasons why outsourcing sucks. You know big Indian companies like Wipro,infosys are taking more people and most of them are sitting idle or waiting for a project. Most of them won't be suited for this job, and they look only for huge salary, not job satisfaction or interest.
BTW, are you doing any outsourcing to India ? If yes, is that going well ? I am just wondering.
|
|
|
|
|
N a v a n e e t h wrote: BTW, are you doing any outsourcing to India ? If yes, is that going well ? I am just wondering.
I have done outsourcing to india and it has been a nightmare every time. I am happy to see that the article of the month has been won by someone with an indian name, I have hired people who I know, who happen to be indian, and who have done a great job, and I see good indian coders at MVP sumits, and here on CP, all the time. But, I think those people are being overwhelmed by the flood of terrible pretend programmers that are a side effect of the outsourcing boom ( which makes it the west's fault, these people are just going where the money is ), and too many people make the mistake of talking about Indian programmers, as if race is the issue. It obviously is not.
So, I would never outsource to india again, it was always hell for me. But, I do hire Indians, some of the best coders I know, happen to have come from India. I just need to know them personally and know they are good, the quality of coders still in India is far to variable to just grab a firm and try to work with them.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian Graus wrote: But, I do hire Indians
That's good. I like to work with you . I think I am good at ASP.NET and windows applications (other than graphics related). If you are planning to hire anyone, I will be glad to get included in to the list of the names you have in mind.
Also don't think that I posted the previous message with this intention, I was just asking your outsourcing experience, after seeing your reply, I just got this idea.
If you are interested, please let me know.
|
|
|
|
|
Fair enough. I am not hiring anyone right now, but if I need someone, I will let you know. Actually, I may have a website job coming up.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian Graus wrote: Actually, I may have a website job coming up.
Thanks. I am looking forward for that
|
|
|
|
|
Interesting that you got the same answer again, even if you deleted your original question and gave me a 1 vote for trying to help you.
I suggest buying a basic book on VB.NET, and reading it, because it's clear there are some fundamentals you do not understand ( like what 'shared' is )
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
A shared ( that's static in VB land, right ) datatable is a very poor design IMO. You need to make your DATABASE the static point, where data is stored permanently across all users. However, I'm not sure how to help you, I'm not sure what your question is. You're surprised that static data is visible to all users ? You expected it to be, but it's not ? What is the problem ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I hate it when people delete their post, and 1 vote people trying to help them. This was his question, for the record
haved declared datatable as shared and when two users are using that page to add data to the datatable the data visible to other user after the postback....
Help me regarding this
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I wrote A code like an exercise that let two Clients make a chat .
How Can I make the two pages send info between each others
And I need To tell some of the two clients that the other one has stopped the conversation By closing the web browser ???????
Is there Any remoting Stuff in this subject or ???? ..
You have To Search About The Truth Of Your Life
Why Are you Here In Life ?
|
|
|
|
|
OK - you're obviously in over your depth. The two instances have no relation to each other. Basically, you can store the association between two users on the server, and you can use AJAX to check for/send messages, so that the page doens't post back all the time. The server needs to negotiate who is talking to who tho, and cue up the messages for each client.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hello friends
How to integrate paypal button in aspx page ?
i am having a code associated with it ..but unable to integrate please advice me how to do it
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
few hidden fileds +
<input type="image" src="https://www.paypal.com/en_GB/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>
Dont Get Paid for the Hours you worked, Get Paid for the Work You Have Done in an Hour.
|
|
|
|
|
Problem Solved ....
I removed the form tags ...took a button .. set postback url to the action url of the above tag ...its working fine .........
Sorry for posting such a silly question
Happy Programming
Dont Get Paid for the Hours you worked, Get Paid for the Work You Have Done in an Hour.
|
|
|
|
|
cell8.Controls.Add(new LiteralControl("<A onclick=" + "window.open('../a.html','_blank','height=200,width=330,menubar=yes','top=40');return false;" + " <span style=" + "font-size:9pt;" + "></span>print</A>"));
i want when i move the mouse on print the pointer convert a hand? can any body help me?
|
|
|
|
|
use
cursor:pointer;
cursor: hand;
in your css. cusror:pointer will not work in firefox. so you have cursor:hand for firefox and cursor:pointer for IE.
|
|
|
|
|
thanks, right. i use cursor:hand in IE and it work
|
|
|
|
|
I have used crystal reports in my web application.
When I am printing the font size is very small in the printed output. On screen I can see it clearly but in the printout the font is very small. I tested it from few machines. Only on some machines I am facing this problem. On other machines it is working properly. Can someone let me know the reason for this?
Uma
|
|
|
|