|
Hello Guys....
I am trying to Bind DropDownList with enum as follows.
cmbFromShape.DataSource = Enum.GetValues(typeof(KavirDiam.Common.Shape));
cmbFromShape.DataBind();
Following is my enum:
public enum Shape
{
Any,
Round,
Princess,
Emerald,
Asscher,
CushionBrilliant,
CushionModify,
Pear,
Radiant,
SQRadiant,
Heart,
Marquise,
Oval
}
While getting Selected Item/Value/Index it is always...returning me 'Any' i.e first member.
I am not able to get the value of selected member.
dipak
|
|
|
|
|
DIPAK@EMSYS wrote: While getting Selected Item/Value/Index it is always...returning me 'Any' i.e first member.
Because you need to give the value as weel for the dropdown list.
Try This :
foreach (Shape shp in Enum.GetValues(typeof(Shape)))
{
ListItem Lstitem = new ListItem(Enum.GetName(typeof(Shape), shp), shp.ToString());
DropDownList1.Items.Add(Lstitem );
}
I have found few things over here also.
How do you bind an Enum to a DropDownList control in ASP.NET?[^]
Thanks !
Cheers !
Abhijit Jana | MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
PLEASE HELP ME I WANT TO SEE CODING FOR CREATE A NEW WEBSITE IN ASP.NET IN C# LANGUAGE LIKE MODIS.
modified on Friday, April 23, 2010 1:33 AM
|
|
|
|
|
kumar gautam 2010 wrote: PLEASE HELP ME I WANT TO SEE CODING FOR CREATE A NEW WEBSITE IN ASP.NET IN C# LANGUAGE LIKE MODIS.
1. You don't need to shout!
2. You want to see coding then find a place where it is written! I would suggest, you write yourself and then see it!
If you have tried something and have specific issues/problems, post here.
|
|
|
|
|
sure,I can create a prototype for ya'
my rate is 100$(USD)/hour + costs.
|
|
|
|
|
annathor wrote: my rate is 100$(USD)/hour + costs.
What kind of Cost ?
Cheers !
Abhijit Jana | MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
The medical costs for injuries sustained while ROTFLMAO
|
|
|
|
|
Very funny... Hey try yourself to make a website if u have any problem then post it here
|
|
|
|
|
Hi,
Can somebody help me to Implimeting indian regional languages(like punjabi,tamil,hindi etc) in asp.net web application its very urgent.
Thanks and regards
Arun Kumar
|
|
|
|
|
The logic behind regional language is to convert the regional text into unicode (the language supported by browser)and this can be done through language converters.
Second way to do is make .eot or .pfr files of your font and access that file in your ASP.NET page.
You have to download WEFT by which you can make eot files of your font.
Just search in Google or you can get it on Microsoft site also.
Something like:
*********************************
<style type="text/css" >
@font-face
{
font-family: AkrutiDevYoginiUnicode;
font-style: italic;
font-weight: normal;
src: url(AKRUTID0.eot);
}
</style>
|
|
|
|
|
My requirment is that the asp.net web apllication will chane in the laguage choosen from dropdown.
Thanks in advance
|
|
|
|
|
Hi All,
I'm having a problem with some code and hope you may have some suggestions. I'm attempting to generate records in an SQL database table whenever a page is loaded by adding and updating rows in a GridView. The following code snippet is part of my Page_Load function and is looped several times.
SqlDataSource1.Insert();
Label Name = GridView1.Rows[0].FindControl("Label1") as Label;
Label Desc = GridView1.Rows[0].FindControl("Label2") as Label;
Label Date = GridView1.Rows[0].FindControl("Label3") as Label;
Label Note = GridView1.Rows[0].FindControl("Label4") as Label;
Name.Text = CN.Text;
Debug.WriteLine("Common Name = " + Name.Text);
Desc.Text = D.Text;
Debug.WriteLine("Description = " + Desc.Text);
Date.Text = DateTime.Now.ToShortDateString();
Debug.WriteLine("Date = " + Date.Text);
Note.Text = N.Text;
Debug.WriteLine("Note = " + Note.Text);
GridView1.UpdateRow(0, false);
I know from the debug output that the looping and label text value assignments are happening correctly. The browser output, however, is a GridView with empty rows - except for the last row! I can understand all the rows being blank, but the fact that it appears to be working to some extent is perplexing me. Any help would be appreciated!
|
|
|
|
|
From whatever I can get of what you have written and the result is: think of a Stack.
For the very first time, the blank row was inserted at 0 and the row was updated at 0 position.
Next time, the new insertion was at 1 but the update was still at 0...
Next time, the new insertion was at 2 but the update was still at 0...
This goes on...
Thus, we got a stack, where the 1st one is having some data, rest all blank.
What say?
|
|
|
|
|
Thanks for the suggestion; it got me on the right track. The actual issue was that I was not refreshing the GridView after adding a row to the SQL table. Once adding the following, all is good:
SqlDataSource1.Insert();
GridView1.DataBind();
...
Thanks for getting my thinking on the right track!
Rob.
|
|
|
|
|
Welcome!
|
|
|
|
|
Hey!
I've got a dialog that I'm calling from javascript (showModalDialog). This dialog has 3 text boxes that get populated with data from a database in my Page_Load - !IsPostBack section of my code. It works fantastically the first time I run the dialog. I change one of the textboxes and click save which writes back to the DB to update that field, and then the window closes.
I open the dialog again, and the textbox which I just changed and saved in the DB (and confirmed that the DB has the new value) still has the original value! I even ran through the page in debug, and it shows the textbox getting assigned the updated value, and yet it still has the old one.
Anyone know what might be wrong? Something this small is enough to make all my other massive changes useless. ARG!!!
Thanks
...
if (!IsPostBack)
try
{
DataSet ds = new DataSet();
ds = programsClass.GetProgramInfo(iProgram);
txtOrder.Text = ds.Tables[0].Rows[0]["id_order"].ToString();
txtHeat.Text = ds.Tables[0].Rows[0]["id_heat"].ToString();
txtPipes.Text = ds.Tables[0].Rows[0]["num_pieces"].ToString();
...
|
|
|
|
|
As you have mentioned that DB is updated correctly, and still you dont see the updated value.
As per your code, you can see 'updated database value' only when page does not post back any data(only first time ). Hence my conclusion is the you are opening the dialog does not RELOAD the page everytime you open using 'showModalDialog'. Your javascript code is expected to RELOAD the page everytime. Does it happend in your javascript code?
Either check your javascript code to make sure it is reloading the Page which is opened using showModalDialog or get the updated database value into dataset irrespective of whether it is postback or not.
Hope it helps you.
Thanks,
Arindam D Tewary
|
|
|
|
|
Ok,
I tried loading the textbox values outside the !IsPostBack section. The problem now is that when I use the dialog the first time, I change my text value and click on my save button. Then it goes through the page_load again, and reloads the DB value for that text box and then saves it, so the DB never gets updated.
How can I force the ShowModalDialog to reload the page each time?
Thanks!
|
|
|
|
|
Can you please post your showDialog code(the code block that you have for opening the page) here ?
Thanks,
Arindam D Tewary
|
|
|
|
|
The code was originally written in Spanish, so I take no responsibility for the variable names. :p
var dlgAncho=900;
var dlgAlto=200;
var vpagina='dlgEditProgram.aspx?parProgram=' + idProgram ;
mDlg=window.showModalDialog (vpagina,null,'dialogHeight:'+dlgAlto+'px;dialogWidth:'+dlgAncho+'px;status=yes');
if(mDlg!=undefined){
document.all['hidOption'].value="REFRESH";
document.all['form1'].submit();
}
|
|
|
|
|
Hi, all,
I have create a gridview in asp.net with C#, there is a column called Project Name which sometimes has long text, now if it's longer then column width, it will wrap to two line, I don't like this, I want to hide the longer part, how can I do it??
The second question is how can I make gridview header column resizable? is it possible if don't use AJAX?
Thanks!
Andraw
|
|
|
|
|
Hi Andraw,
you can use the DataBound event of the Gridview as per the below code:
protected void gvProjects_RowDataBound(object sender, GridViewRowEventArgs e)
{
string projectName = ((DataRowView)e.Row.DataItem)["ProjectName"].ToString();
if (projectName.Length > 200)
{
projectName.Substring(0, 200);
}
}
or you can loop over the list/DataTable (the Datasource) that you are using to bind your GridView and check the length of the project name and Substring it.
Regards,
Jamil
|
|
|
|
|
Hi, Jamil,
Thanks for your reply. If I limited the text length, when I resize the column width, the cut part cannot be displayed, right?
why <itemstyle wrap="false"> doesn't work?
I will try your link in the next reply.
|
|
|
|
|
yes , if you set the length of the text then when resizing the column the hidden part of the text will appear again because it is already rendered.
This is totally related to the pattern of resizing that you are going to use.
Regards,
Jamil
|
|
|
|
|
But if we fixed the text length to 200, even the column is resized, we still cannot see the extra part, am I right?
|
|
|
|