|
Dear all,
i am making web application using asp.net2.0,C#,sql2000 using VS2005.
In a form i have two dropdownlistbox where first i am populating it through sqldatasource. and second dropdownlistbox, I populate programically based on value of first. Now i woulsd like select one option set as default to second dropdownlistbox too. i did try with the following code. but as i used clear in code. May be because of that. Select One option not appear. Please Help me in solving this problem.i first define dropdownlistbox as
<asp:dropdownlist id="DropDownListcode" runat="server" appenddatabounditems="True"
autopostback="True" datasourceid="SqlDataSource2" datatextfield="display"
datavaluefield="Groundmode" onselectedindexchanged="DropDownListcode_SelectedIndexChanged"
style="left: 187px; position: absolute; top: 150px" width="200px">
<asp:listitem text="Select One">
and On it selectedindex_changed. i fetch data from database and populate it as
setting = ConfigurationManager.ConnectionStrings["databaseconnection"];
if (setting != null)
{
conn = new SqlConnection(setting.ConnectionString);
cmd = new SqlCommand("Sp_Grab_maxno_grdtran");
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@mode", SqlDbType.VarChar);
cmd.Parameters["@mode"].Value = DropDownListcode.SelectedValue;
cmd.Connection = conn;
conn.Open();
rdr = cmd.ExecuteReader();
if (rdr.Read())
{
try
{
int count = int.Parse(rdr["groundmaxno"].ToString());
DropDownListmaxno.Items.Clear(); // used to clear previous record fetched by other option//DropDownListmaxno.Items[0].Text = "Select One";
for (int i = 0, j = 1; i < count; i++, j++)
{
//DropDownListmaxno. = j.ToString();
//DropDownListmaxno.Items[i].Value = j;
DropDownListmaxno.Items.Add(new ListItem(j.ToString()));
}
}
please help
thanks
regards
imran khan
|
|
|
|
|
Does it mean that you want to show the Select one as first in drop down list
Write this line
DropDowmList2.Items.Insert(0, new ListItem("Select One"));
Thanks and Regards
Sandeep
If you want something you never had,
do something you have never done!
|
|
|
|
|
i need help in converting results retrieved and stored as an XmlNode to be displayed on a datagrid. i'm new to asp.net so any help or suggestions would be greatly appreciated. thanks in advance!
Dim ws As New WRcinema.WebServices
Dim results As XmlNode
Try
results = ws.fnEnquireFilmRecords("1B014", "", "", "", 9, 2006, 0, 0)
' Dim onode As XmlNodeList = results.SelectNodes("/")
Dim n As Integer
Catch ex As Exception
Response.Write(ex.Message)
End Try
|
|
|
|
|
Please delete the unwanted posts
Thanks and Regards
Sandeep
If you want something you never had,
do something you have never done!
|
|
|
|
|
Hi
I have a checkbox in gridview in asp.net page and also contain a link that open popup in gridview. once user close the popup, the checkbox should be checked for that record. Wonder how do i achieve this?
Regards
Nancy
|
|
|
|
|
szewanng wrote: once user close the popup, the checkbox should be checked for that record
When showing popup pass the checkbox id to that page. And from the popup page use javascript's parent property to set the chekbox checked.
|
|
|
|
|
Thanks for your reply.
Could you please provide some sample code?
Thanks
Nancy
|
|
|
|
|
I have several reports created. I want to get them to stretch to the width of the ReportViewer control.
Currently they remain a static width and on some machines they show squeezed up.
Is there a way to get the reports to either dynamically change with the Browser (like the reportviewer control does, or to make the reports be the size of the viewer by default?
Thanks for any tips!
PhrankBooth
|
|
|
|
|
|
Tried Zoom but it doesn't do anything like I want.
I basically need the report to behave like a webpage; when you resize the browser window the page resizes along.
Anyone have ideas about this, is there a setting I'm missing?
Thanks!
PhrankBooth
|
|
|
|
|
This is the answer:
ReportViewer.AsyncRendering = false
ReportViewer.SizeToReportContent = true
PhrankBooth
|
|
|
|
|
Hi Guys,
This is a newbie type question for ya.
I have a datalist on a usercontrol, that is bound to an object datasource.
What I want to do is display a default message if the objsource does not return any records,
|
|
|
|
|
Not sure I understand, but I think what you're asking is how to find out the number of rows in a datalist? Look for List.Rows.Count, and then take action (such as hiding the list and showing a div) depending on the result...
Or have I misunderstood you?
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
hi
i wanted to build a print button in asp.net 2.0
i wrote the following code
"codebehind"
<br />
<br />
protected void Button1_Click(object sender, EventArgs e)<br />
{<br />
Button1.Attributes.Add("onClick","window.print()");<br />
Button1.Visible = false;<br />
<br />
}
now.. the button does disappear, but the print window doesnt come up.
please help.. and i dont want a html input button.
Kunal
|
|
|
|
|
For this code to work you need to add the attributes before the button is clicked.
So on the page load event do
if (!IsPostback)
{
Button1.Attributes.Add("onClick","window.print()");
}
Then it should work like you want it to.
Hope that helps.
Ben
|
|
|
|
|
the thing worked, but theer`s a little problem.
i want the button to go invisible, so that when the printing is done, the button does not show up.
right now as i click the button, the print window comes, and then the button goes invisible.
Kunal
|
|
|
|
|
You might want to get rid of the codebehind and do something like this:
Change this line:
Button1.Attributes.Add("onClick","window.print()");
to:
Button1.Attributes.Add("onClick","document.getElementById("+Button1.ClientId+").style.visibility = 'hidden';window.print();");
I think that should work for you.
Ben
|
|
|
|
|
kubben wrote: You might want to get rid of the codebehind and do something like this:
did get rid of the codebehind, removed the defintion for "Button1_Click".
and placed the following code in the page_load event
if (!IsPostBack)
{
Button1.Attributes.Add("onClick", "document.getElementById(" + Button1.ClientID + ").style.visibility = 'hidden';window.print();");
}
but nothing seems to happen at all. nor does the button disappear, and neither does the print window come up
Kunal
|
|
|
|
|
Ok I did a little playing. It looks like you will need to create a javascript funciton.
In the header section of your html page you need this function:
<head runat="server">
<title>Your page name here</title>
<script type="text/javascript" >
function doPrint(button)
{
button.style.visibility = "hidden";
window.print();
return false;
}
</script>
</head>
Then in the page load event do this:
Button1.Attributes.Add("onClick", "return doPrint(" + Button1.ClientID + ");");
That will work.
NOTE as soon as your page posts back to the server the print button will show up again.
Hope that helps.
Ben
|
|
|
|
|
thanks ben..
uve been a great help to me.. i dunno if ud remember helping me.. but i do remember the relief i get when i see the answer is from kubben in the forum..
i know.. this problem is no more a problem..
thx again...
Kunal
|
|
|
|
|
Glad I could help out. Sorry I didn't get it right the first time.
Ben
|
|
|
|
|
no problemo.. all is well that ends well..
Kunal
|
|
|
|
|
Hi guys, I need help to run this page (MoveGridRows.aspx) what is happening when i run on my localhost I do get the datagrid populated but when i click on the move up and move down button nothing hapenned. Infact i get an error on the status bar of the window
msdn.microsoft.com/msdnmag/issues/05/03/CuttingEdge/[^]
|
|
|
|
|
Hi
Can any one help me how to grab inner html from iframe using Java Script and use it in server side.i tried in several ways but failed to do so.
this is the javascript function i am using
function GetMsg()
{
document.getElementById("HidTemp").innerText =NewsBody_rich.document.body.innerHTML;
//document.getElementById("HidTemp").value=NewsBody_rich.document.body.innerHTML;
}
HidTemp = a HTML Hidden input Type;
NewsBody_rich = a iframe run at server;
and this is the code in .cs file on page load event.
btnSend.Attributes.Add("onClick", "GetMsg();");
btnsend= a asp:button
when i click on this button i am getting a error message
Sys.WebForms.PageRequestManagerServerException:an unknown error occured while processing request on server.the status code returned from the server was :500
please help me out this problem.
|
|
|
|
|
TRK@UK wrote: function GetMsg()
{
document.getElementById("HidTemp").innerText =NewsBody_rich.document.body.innerHTML;
//document.getElementById("HidTemp").value=NewsBody_rich.document.body.innerHTML;
}
Why don't you comment the first line and uncomment the commented line ? I don't think that HTML input hidden field is having innerText Property !
My suggestion is make the HidTemp to runat server. Then you can easily get the value on server side.
TRK@UK wrote: NewsBody_rich.document.body.innerHTML;
I think this will work only on IE...
|
|
|
|