Click here to Skip to main content
15,887,267 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionCrystal Reports pritning problem Pin
Uma Kameswari25-Apr-08 20:25
Uma Kameswari25-Apr-08 20:25 
AnswerRe: Crystal Reports pritning problem Pin
Vasudevan Deepak Kumar30-Apr-08 1:48
Vasudevan Deepak Kumar30-Apr-08 1:48 
GeneralRe: Crystal Reports pritning problem Pin
Uma Kameswari2-May-08 21:27
Uma Kameswari2-May-08 21:27 
Questionwhat is the problem while it browsed in IE 7 with another tab in same window of IE 7 Pin
hiren dave25-Apr-08 20:07
hiren dave25-Apr-08 20:07 
AnswerRe: what is the problem while it browsed in IE 7 with another tab in same window of IE 7 Pin
Vasudevan Deepak Kumar30-Apr-08 1:50
Vasudevan Deepak Kumar30-Apr-08 1:50 
QuestionHow Can I store GridView in database? Pin
vishalcodeproj25-Apr-08 20:04
vishalcodeproj25-Apr-08 20:04 
GeneralRe: How Can I store GridView in database? Pin
N a v a n e e t h26-Apr-08 5:10
N a v a n e e t h26-Apr-08 5:10 
Generaldropdownlist loses its style on other control postback event. Pin
mohd imran abdul aziz25-Apr-08 18:47
mohd imran abdul aziz25-Apr-08 18:47 
Hi all
I am using asp.net , C# ( VS2005)
I fill dropdownlist using method defined in class on page load event it sucessfully fill the data in dropdownlist. as there is customer requirment to show different class of people in different color as well as tooltip of data. i succesffully managed to fill this with below shown code . but issue is when i fires other controls postback event. this dropdownlist loses its color as well as tooltip .
Please suggest how to maintain the style of dropdownlist.

code to fill dropdownlist

public void Fillemp(DropDownList ctrl, string procedurename, string conn, SqlCommand cmd)<br />
{	<br />
try<br />
{<br />
if (con == null)<br />
{<br />
this.openconnection(conn);<br />
this.con.Open(); // con.Open();<br />
}<br />
if (con.State == ConnectionState.Closed)<br />
{<br />
this.openconnection(conn);<br />
con.Open();<br />
}<br />
DataTable dtcompany = new DataTable();<br />
ctrl.Items.Clear();<br />
dtcompany = GetDataTable(procedurename, cmd);<br />
ctrl.Items.Add(new ListItem("Select One", "0"));<br />
ctrl.Items.Add(new ListItem("All" , "1"));<br />
ctrl.Items.Add(new ListItem("Self" , "2"));<br />
foreach (DataRow row in dtcompany.Rows)<br />
{<br />
ListItem item = new ListItem(row["emPname"].ToString(), row["er_emp_code"].ToString());<br />
item.Attributes.Add("title", row["empname"].ToString());<br />
int lvl = int.Parse(row["er_user_lvl"].ToString());<br />
switch(lvl)<br />
{<br />
case 8:<br />
 <br />
item.Attributes.Add("style", "color:green");<br />
break;<br />
case 7:<br />
item.Attributes.Add("style", "color:blue"); <br />
break;<br />
case 6:<br />
item.Attributes.Add("style", "color:red"); <br />
break;<br />
case 5:<br />
item.Attributes.Add("style", "color:purple"); <br />
break;<br />
default :<br />
item.Attributes.Add("style", "color:BLACK"); <br />
break;<br />
 <br />
}<br />
ctrl.Items.Add(item); <br />
 <br />
 <br />
 <br />
}<br />
 <br />
 <br />
}<br />
catch (Exception ex)<br />
{<br />
throw ex;<br />
}<br />
finally<br />
{<br />
if (con != null)<br />
{<br />
con.Close();<br />
}<br />
}<br />
}<br />


page load event where i fill the dropdownlist

 if (!(IsPostBack)) <br />
{<br />
SqlCommand cmd = new SqlCommand();<br />
cmd.Parameters.AddWithValue("empcode", Membership.GetUser().UserName);<br />
Doctor dr = new Doctor();<br />
dr.Fillemp(Ddlzse, "SpGetPredecessor", "bbraunemisconnectstring", cmd);<br />
dr.FillctrlList1(Ddlsubdiv, "SPGETSUBDIV_GIVENEMP", "bbraunemisconnectstring", cmd, 0);<br />
 <br />
 <br />
}<br />

and dropdownlist is defined as
 <br />
<TD id ="tdddlzsm" style="BORDER-BOTTOM: gray 1px solid; TEXT-ALIGN: left ;     width: 490px;" align ="center"  ><br />
<asp:DropDownList id="Ddlzse" runat="server" Width="480px"  Font-Bold="False"   Font-Size="9pt"  Font-Names="Arial"   AppendDataBoundItems="True" ></asp:DropDownList><br />
</TD><br />
 <br />


regards
imran khan
Generaldynamic bind GridView Pin
jason_mf25-Apr-08 16:14
jason_mf25-Apr-08 16:14 
GeneralRe: dynamic bind GridView Pin
vishalcodeproj25-Apr-08 19:30
vishalcodeproj25-Apr-08 19:30 
GeneralRe: dynamic bind GridView Pin
jason_mf25-Apr-08 20:31
jason_mf25-Apr-08 20:31 
AnswerRe: dynamic bind GridView Pin
samMaster25-Apr-08 20:18
samMaster25-Apr-08 20:18 
Generalcreating an output file and manipulating the data in the output file Pin
Programmer9925-Apr-08 12:23
Programmer9925-Apr-08 12:23 
GeneralRe: creating an output file and manipulating the data in the output file Pin
Christian Graus25-Apr-08 20:23
protectorChristian Graus25-Apr-08 20:23 
GeneralSubmit Button and TextBox Pin
Ekjon25-Apr-08 10:19
Ekjon25-Apr-08 10:19 
GeneralRe: Submit Button and TextBox Pin
AlexeiXX325-Apr-08 14:10
AlexeiXX325-Apr-08 14:10 
GeneralRe: Submit Button and TextBox Pin
Ekjon25-Apr-08 19:02
Ekjon25-Apr-08 19:02 
GeneralRe: Submit Button and TextBox Pin
AlexeiXX326-Apr-08 7:20
AlexeiXX326-Apr-08 7:20 
GeneralRe: Submit Button and TextBox Pin
Ekjon26-Apr-08 8:19
Ekjon26-Apr-08 8:19 
GeneralCreating a Menu with the Menu object Pin
dptalt25-Apr-08 8:40
dptalt25-Apr-08 8:40 
AnswerRe: Creating a Menu with the Menu object Pin
samMaster25-Apr-08 23:44
samMaster25-Apr-08 23:44 
GeneralRe: Creating a Menu with the Menu object Pin
dptalt28-Apr-08 9:19
dptalt28-Apr-08 9:19 
QuestionPersonality Profilling with ASP.NET? Pin
Taurian11025-Apr-08 4:55
Taurian11025-Apr-08 4:55 
AnswerRe: Personality Profilling with ASP.NET? Pin
Krazy Programmer25-Apr-08 6:08
Krazy Programmer25-Apr-08 6:08 
JokeRe: Personality Profilling with ASP.NET? Pin
Taurian11025-Apr-08 9:27
Taurian11025-Apr-08 9: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.