Click here to Skip to main content
15,925,602 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: To Change an Image into different formats? Pin
MudkiSekhon3-May-06 3:39
MudkiSekhon3-May-06 3:39 
QuestionPivot table programming with c#, asp.net Pin
sohne3-May-06 0:11
sohne3-May-06 0:11 
AnswerRe: Pivot table programming with c#, asp.net Pin
J4amieC3-May-06 0:41
J4amieC3-May-06 0:41 
QuestionIn Drop down list, how to convert the list into suitable data Pin
ahjiefreak2-May-06 23:34
ahjiefreak2-May-06 23:34 
AnswerRe: In Drop down list, how to convert the list into suitable data Pin
NeverHeardOfMe3-May-06 0:12
NeverHeardOfMe3-May-06 0:12 
GeneralRe: In Drop down list, how to convert the list into suitable data Pin
ahjiefreak3-May-06 4:29
ahjiefreak3-May-06 4:29 
GeneralRe: In Drop down list, how to convert the list into suitable data Pin
NeverHeardOfMe3-May-06 5:50
NeverHeardOfMe3-May-06 5:50 
AnswerRe: In Drop down list, how to convert the list into suitable data Pin
Kanjinghat3-May-06 21:39
Kanjinghat3-May-06 21:39 
While hard-coding the DropDownlist entries, i hope you have set both Text and Value properties. if not go to the properties window of the dropdown list and click on the columns property, which will pop up new window enabling you to enter Text and Value propeties for that ddlist. if you are binding the DD list in code behind code then follow as below

DropDownList1.Items.Insert(0,"1day");<br />
DropDownList1.Items[0].Text="1 day";<br />
DropDownList1.Items[0].Value="1";<br />
<br />
DropDownList1.Items.Insert(1,"2days");<br />
DropDownList1.Items[0].Text="2 days";<br />
DropDownList1.Items[0].Value="2";


go on filling the DropDownList1 as shown above.

string val = DropDownList1.SelectedValue.ToString();

will give the Selected value of the DropDownList1

now below code will change the value of the DataGrid1 Cell values for the entire date Column.

here it si assumed that Date column is the first column. if the Column position is n then replace Cell[0] with Cell[n-1]
for(int i=o;i<DatGrid1.Item.Count;i++)<br />
{<br />
DataGrid1.Item[i].Cells[0].Text = Convert.ToDateTime(DataGrid1.Item  [i].Cells[0].Text.ToString().AddDays(Convert.ToDouble  (DropDownList1.SelectedValue.ToString())).ToString("MM/dd/yyyy") ;<br />
}

Above Single line of code can replaced as given below

string DDval = DropDownList1.SelectedValue.ToString();<br />
for(int i=o;i<DatGrid1.Item.Count;i++)<br />
{<br />
   DateTime CellVal = Convert.ToDateTime(DataGrid1.Items[i].Cells[0].Text.ToString());<br />
<br />
    CellVal = CellVal.AddDay(DropDownList1.SelectedValue.ToString());<br />
<br />
    DataGrid1.Item[i].Cells[0].Text = CellVal.ToString("MM/dd/yyyy"); <br />
<br />
}



once the values have been changed in the datagrid it is up to you to update the same to the database.

Cheer


Ramesh.Kanjinghat
GeneralRe: In Drop down list, how to convert the list into suitable data Pin
Kanjinghat3-May-06 21:44
Kanjinghat3-May-06 21:44 
Questionhow to add flash Pin
ramyasangeet2-May-06 23:22
ramyasangeet2-May-06 23:22 
AnswerRe: how to add flash Pin
Jakob Farian Krarup2-May-06 23:49
Jakob Farian Krarup2-May-06 23:49 
QuestionRe: how to add flash Pin
ramyasangeet3-May-06 1:36
ramyasangeet3-May-06 1:36 
AnswerRe: how to add flash Pin
Jakob Farian Krarup3-May-06 2:17
Jakob Farian Krarup3-May-06 2:17 
QuestionHide a column in gridview filled by dataset Pin
dumser12-May-06 23:14
dumser12-May-06 23:14 
AnswerRe: Hide a column in gridview filled by dataset Pin
Paddy Boyd2-May-06 23:25
Paddy Boyd2-May-06 23:25 
GeneralRe: Hide a column in gridview filled by dataset Pin
dumser13-May-06 1:32
dumser13-May-06 1:32 
Question.Net viewstate, keeping class on button click Pin
cullyk2-May-06 23:02
cullyk2-May-06 23:02 
AnswerRe: .Net viewstate, keeping class on button click Pin
Paddy Boyd2-May-06 23:06
Paddy Boyd2-May-06 23:06 
QuestionHow to pass Mulitple values through 'location.href' ?? Pin
Abubakarsb2-May-06 22:33
Abubakarsb2-May-06 22:33 
AnswerRe: How to pass Mulitple values through 'location.href' ?? Pin
Paddy Boyd2-May-06 22:46
Paddy Boyd2-May-06 22:46 
GeneralRe: How to pass Mulitple values through 'location.href' ?? Pin
Abubakarsb3-May-06 9:34
Abubakarsb3-May-06 9:34 
AnswerRe: How to pass Mulitple values through 'location.href' ?? Pin
Guffa3-May-06 0:23
Guffa3-May-06 0:23 
Questionhow to do "Lucene- WildCard Search" Pin
kpsetty2-May-06 22:32
kpsetty2-May-06 22:32 
AnswerRe: how to do &quot;Lucene- WildCard Search&quot; Pin
R.Prabha Devi3-May-06 1:57
R.Prabha Devi3-May-06 1:57 
QuestionCreate Directory..... Pin
NeverHeardOfMe2-May-06 22:27
NeverHeardOfMe2-May-06 22:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.