|
Where are you binding the control ?
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
Check My Blog
|
|
|
|
|
on form load, i add if (ispostback){combo1.databind()}
|
|
|
|
|
There's your problem. you want to databind when its not a postback, not when it is!
|
|
|
|
|
Put in Page Init method and check if it works
then figure out in Page Load method
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
Check My Blog
|
|
|
|
|
hie Sanddeep, im sorry but i do i edit the page init method, i havent done that before in ASP.
Thank you.
|
|
|
|
|
i created my this file and added the code(cboRole is my combobox)
is this what u meant, but i didnt work though.
protected void Page_Init(object sender, EventArgs e)
{
cboRole.DataBind();
}
|
|
|
|
|
Also make sure that your combobox bind when page ispostback property false.
on page load event
if(!IsPostBack)
{
//Bind Combobox here
}
please don't forget to vote on the post that helped you.
|
|
|
|
|
But he said he doesn't bind to it at all.....
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Hie guys i have added the viewstate, for the control and the page to true, i have also bind the control(combobox)-on postpage is true, but it still loses the value.
i have used comboboxes many times before but im suprised on the behaviour of this one particular one.
|
|
|
|
|
Post your code so that we can examine where are you going mistake.
please don't forget to vote on the post that helped you.
|
|
|
|
|
Christian Graus wrote: But he said he doesn't bind to it at all.....
No.He said he loses selected value on postback.
please don't forget to vote on the post that helped you.
|
|
|
|
|
I have noticed that it just not losing the selected value but also writing a blank text. the Viewstates are now enabled and still no change
|
|
|
|
|
Can you post your code, it might help us re-create your problem
|
|
|
|
|
here is my page load module;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
lngSiteID = Convert.ToInt64(Request.QueryString["ID"]);
LoadSiteDetail(lngSiteID);
//loadSiteTreeView();
Session["AddNewRecord"] = "false";
tvwSites.CollapseAllNodes();
tboSiteID.Text = Convert.ToString(lngSiteID);
LoadCombos();
MainContactLoad(lngSiteID);
//LoadData();
}
else
{
lngSiteID = Convert.ToInt64(Request.QueryString["ID"]);
//tboLocation.Text = (string)Session["LocName"];
//LoadSiteDetail(lngSiteID);
//MainContactLoad(lngSiteID);
cboContact.DataBind();
}
}
|
|
|
|
|
here is my page load module;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
lngSiteID = Convert.ToInt64(Request.QueryString["ID"]);
LoadSiteDetail(lngSiteID);
//loadSiteTreeView();
Session["AddNewRecord"] = "false";
tboSiteID.Text = Convert.ToString(lngSiteID);
LoadCombos();
MainContactLoad(lngSiteID);
//LoadData();
}
else
{
lngSiteID = Convert.ToInt64(Request.QueryString["ID"]);
cboContact.DataBind();
}
}
|
|
|
|
|
Hie all, did anyone manage to figure out what is causing the combos on my forms to lose values.
Thank you
|
|
|
|
|
hai all,
i am using .net 2005.i do my project in asp.net.
i am doing master log attendace.the field names are name,fromdate,todate.
i keep tools are namedropdownlist,fromdateTextbox,todatetextbox,2 calendars and submit button.
ex-1
If i select name 'arun' from namedropdownlist,then i click june 1 2008 in first calendar,then displayed as '06/01/2008' in from date textbox.Then i click june 4 2008 in second calendar,then displayed as '06/04/2008' in todatetextbox.Then i click submit button means,the following output is display,
Name ----- 6/1/2008 --- 6/2/2008 --- 6/3/2008 --- 6/4/2008
Arun ---------- x
Arun ------------------------- x
Arun ---------------------------------------- x
Arun -------------------------------------------------------- x
in above there are 4 lines.
But i want following output in single line
Name 6/1/2008 6/2/2008 6/3/2008 6/4/2008
Arun --------- x --------- x ---------- x ---------- x
note: x is present,dash(-) indicate space.
here name is field.the above 4 date are where i selected from date as june 1 and todate as june 4.
ex-2
If i select 'All Details' from namedropdownlist,then i click june 6 2008 in first calendar,then displayed as '06/06/2008' in from date textbox.Then i click june 9 2008 in second calendar,then displayed as '06/09/2008' in todatetextbox.Then i click submit button means,the following output is display,
Name ---- 6/6/2008 --- 6/7/2008 --- 6/8/2008 --- 6/9/2008
Arun --------- x
Arun ------------------------ x
Arun --------------------------------------- x
Arun ------------------------------------------------------- x
Bala ---------- x
Bala ------------------------ x
Kumar -------- x
Kumar ------------------------------------------------------ x
But i want following output
Name ---- 6/6/2008 --- 6/7/2008 --- 6/8/2008 --- 6/9/2008
Arun --------- x ------------ x ------------ x ------------ x
Bala --------- x ------------ x
Kumar ------ x ------------------------------------------ x
note: x is present,dash(-) indicate space,empty space is absent.
here name is field.the above 4 date are where i selected from date as june 6 and todate as june 9.
the following codes are,
protected void img_submit_Click(object sender, ImageClickEventArgs e)
{
from_date = txt_fr_date.Text;
to_date = txt_to_date.Text;
emp_name = ddl_emp_name.SelectedValue;
check();
}
void check()
{
System.TimeSpan dt_diff = Convert.ToDateTime(to_date).Subtract(Convert.ToDateTime(from_date));
days = dt_diff.Days;
for (int i = 0; i <= days; i++)
{
sql_date = Convert.ToDateTime(from_date).AddDays(i).ToString("MM/dd/yyyy");
sql_date1 = Convert.ToDateTime(from_date).AddDays(i).ToString("MM/dd/yyyy");
dt.Columns.Add(new DataColumn(sql_date1, typeof(string)));
drow = dt.NewRow();
com = new SqlCommand("select * from tbl_report where emp_id='366' and datetime1='" + sql_date + "'", con);
dr = com.ExecuteReader();
while (dr.Read())
{
drow = "x";
dt.Rows.Add(drow);
}
dr.Close();
}
GV_musterrole.DataSource = new DataView(dt);
GV_musterrole.DataBind();
}
|
|
|
|
|
This code will blow up for all sorts of reasons. What if a non valid date is entered ?
What you want to do, should be done in the DB, it's called a pivot table.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
hello friends,
i am using excel report in asp.net. my excel report is working fine when run within cs file. when publish the project to run on iis the show error. object refrance not set.
|
|
|
|
|
That means something you assumed would never be null, is null. Perhaps because Excel is not on the server ? I am obviously guessing, no-one could actually pinpoint the error without seeing the code that is throwing the exception.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Server Error in '/WebSetup4' Application.
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
Anyone having any idea ???
|
|
|
|
|
As the error messsage is saying there is error in the application
to see the specific error make the custom Error mode off in web.config
<customErrors mode="Off"/>
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
Check My Blog
|
|
|
|
|
Hello all,
I am having one difficulty. I am developing a website. On my home page i am having some article and in need that these article should move contentiously in a div tag (like marquee tag moves but marquee tag move horizontally i need it to be move vertically) and on mouse over of any link they should stop moving. How should i implement this. Please guide me.
Thanks
Rahul
SOLVED
People Laugh on me Because i am Different but i Laugh on them
Because they all are same.
modified on Monday, August 11, 2008 7:56 AM
|
|
|
|
|
You should write a javascript function which will control the scrolling of the content
|
|
|
|
|
Hi Manas,
Can u provide me any sample code?
Thanks
Rahul
SOLVED
People Laugh on me Because i am Different but i Laugh on them
Because they all are same.
modified on Monday, August 11, 2008 7:56 AM
|
|
|
|