|
try this
for (var i = 0; i < states.Tables[0].Rows.length; ++i)
{
document.getElementById("ddlState").options[document.getElementById("ddlState").options.length] = new Option(states.Tables[0].Rows[i].StateName, states.Tables[0].Rows[i].StateId);
}
or
document.getElementById("ddlState").options[0] =value;
Ashutosh kumar
|
|
|
|
|
Hi Ashutosh,
Thank you for your reply.
Can I please know what "ddlState" is? Is it the name of the Listbox I want to display the words, or the control that has the sentance?
If it is the Listbox, where can I pass the sentance? And should I use something to split the sentance first?
Thanks,
|
|
|
|
|
yes ddlState is a id of dropdownlist.
value is a variable through which we can insert data into list.
Aashutosh Kumar
|
|
|
|
|
Hi Ashutosh,
Sorry, I'm still not very clear about these codes
Does it work the same for ListBox as well?
So what is "states"? Is it a name of a talbe or a DataSet or something?
Aashutoshkumar wrote: for (var i = 0; i < states.Tables[0].Rows.length; ++i)
What about "StateName" and "StateId"? Are these some kind of a property or it will be the Name and ID of the DataSet?
Aashutoshkumar wrote: document.getElementById("ddlState").options[document.getElementById("ddlState").options.length] = new Option(states.Tables[0].Rows[i].StateName, states.Tables[0].Rows[i].StateId);
How about the "or" is it a part of the code or it's the next line of the code will do the same thing as the codes above, so it is another option for me?
Aashutoshkumar wrote:
or
document.getElementById("ddlState").options[0] =value;
Thank you for answering me. And sorry about the trouble, without understanding them I can not modify them and customise into my codes.
Thanks again,
|
|
|
|
|
Hi,
I run a web portal where people buy tickets online. I am interested in taking their feedback 2 days after their journey. This requires me to send mails everyday to get their feedback.
I created a HTML format mail which can be sent. As of now, Everyday I use a small web page and a submit button to send mails to those who have travelled. But How can I automate or schedule so that these mails are sent regularly.
Is there any scheduler or can we do any automation in ASP.NET?
Thanks
-Sudhakar
|
|
|
|
|
Hi Sudhakar,
I have a suggestion. Create console application and write a code for Send Mail In C#
Like
using System.Web.Mail;
using System.Windows.Forms;
// Create a function
public SendMail()
{
MailMessage objMail = new MailMessage ();
objMail.From = "ABC@gamil.com"
objMail.To = "PQR@gmail.com;
objMail.Subject = "This is Test Mail;
objMail.BodyFormat = MailFormat.Html ;
objMail.Body = "Hi ,This is a test mail for you;
try
{
SmtpMail.Send (objMail);
}
catch (System.Web.HttpException exHttp )
{
MessageBox.Show("Exception occurred:- " + exHttp.ToString() ) ;
}
finally
{
objMail = null;
}
}
Write Body in HTML Format.A good idea is store all email who have travelled in XML and read from XML and send Mail to Client.
To schedule sending email every day .Windows schedule help you.I Mean to say you can shedule exe in windows schedular.If u need code then let me know i will send.
I hope this will you.
rajesh
|
|
|
|
|
How do u shedule exe in windows schedular.Colud u pls send code for the same.
Thanks Mini
|
|
|
|
|
To add the application to the Task Scheduler .Go to ControlPanel/ScheduledTasks.
Regards
rajesh
|
|
|
|
|
Hello Rajesh,
Is there any way we can achieve the same through coding instead of accessing the control panel
Thanks,
Mini
|
|
|
|
|
whn i press Enter Key in a textBox thn i call a particular Button_click. so how can i call give me suggestion.
Smile a lots its cost nothing so Keep smiling.
Deepak
|
|
|
|
|
Hi there,
You can set the defaultbutton for your page in the <form> tag. Whenever you press the Enter key in a web page (from you TextBox), You can call a particular Button's Click event.
Another way to fire a "click" event of LinkButton based on pressing enter in a text field. It works OK in IE and Firefox only. Here, LinkButton1 is a linkbutton .
TextBox.Attributes.Add("onKeyPress", "javascript:if (event.keyCode == 13) __doPostBack('" + LinkButton1.UniqueID + "','')");
Regards,
Jay
|
|
|
|
|
Hello,
I tried using your code ,I have written Response.write in the click event of button
private void LinkButton1_Click(object sender, System.EventArgs e)
{
Response.Write("I have pressed Enter Key");
}
However there is nothing displayed as i press enter key in Textbox.
Thanks,
Mini
|
|
|
|
|
Hi there,
Add an additional TextBox Web control to overcome the Enter problem in IE, but hide the TextBox so your users see only one:
<form id="Form1" runat="server">
<div>
Name: <asp:TextBox runat="server" id="txtName"/>
<br />
<asp:TextBox ID="TextBox1" runat="server" style="visibility:hidden;display:none;" />
<asp:LinkButton ID="LinkButton1" runat="server" <pre>OnClick ="LinkButton1_Click">LinkButton</asp:LinkButton>
</div>
In ur Code Behid:
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
<br />
txtName.Attributes.Add("onKeyPress", "javascript:if (event.keyCode == 13) __doPostBack('" + LinkButton1.UniqueID + "','')");<br />
<br />
}<br />
<br />
protected void LinkButton1_Click(object sender, EventArgs e)<br />
{<br />
txtName.Text = "Hai";<br />
}<br />
<br />
Now it works fine.
-- modified at 3:37 Wednesday 11th October, 2006
Regards,
Jay
|
|
|
|
|
Hi Jay,
I tried to write code as advised u,I even copy pasted the same code but it still isn't working.
What could b the problem?
Thanks,
Mini
|
|
|
|
|
Hi there,
+ I ve just given the idea only. I have just modified my previous post My Post[^]
Now you can copy and use it, it ll work fine. Try it and let me know.
Regards,
Jay
|
|
|
|
|
Thanks Jay now its working fine
Mini
|
|
|
|
|
Thats Good
Regards,
Jay
|
|
|
|
|
i have a datagrid(in c# asp.net) and i want select more than one record
e.g. i want to have a templete coulmn with checkbox and select more than one record for deleting. can any body help me?
do u know other way for multiselect?
-- modified at 3:48 Saturday 7th October, 2006
|
|
|
|
|
i want to copy the 10 rows of a datatable to another datatable
but it occur a error "This row already belongs to another table."
how can i solve it ?
MHF
|
|
|
|
|
Traverse your 10 rows and while traversing create array of objects to store information of each field and insert this object to destination table.
eg. Source Table is dsTempSearchMemo and Destination is dtSearchSeizureTemp
//For Loop
object[] objVal = {
dsTempSearchMemo.Rows[j][0],
dsTempSearchMemo.Rows[j][1],
dsTempSearchMemo.Rows[j][2],
dsTempSearchMemo.Rows[j][3],
dsTempSearchMemo.Rows[j][4],
dsTempSearchMemo.Rows[j][5],
dsTempSearchMemo.Rows[j][6],
dsTempSearchMemo.Rows[j][7],
dsTempSearchMemo.Rows[j][8],
dsTempSearchMemo.Rows[j][9],
dsTempSearchMemo.Rows[j][10],
dsTempSearchMemo.Rows[j][11],
dsTempSearchMemo.Rows[j][12],
dsTempSearchMemo.Rows[j][13],
dsTempSearchMemo.Rows[j][14],
dsTempSearchMemo.Rows[j][15]
};
dtSearchSeizureTemp.Rows.Add(objVal);
|
|
|
|
|
What you have tried is to copy the reference of the rows. What you have to do is to copy the actual rows, i.e. create new rows with the same data.
---
b { font-weight: normal; }
|
|
|
|
|
Is there any Standard to write code comments for c# ASP.NET projects?
|
|
|
|
|
abhisheks23 wrote: Is there any Standard to write code comments for c# ASP.NET projects?
Everyone has an opinion - so I'd say there are many standards for commenting code. If you want to get some ideas of codified standards (pun not intended), try google for "c# commenting standard".
|
|
|
|
|
i write asp not asp.net
don't error but data not insert into database
i don't sure i write wrong
//code//
//when input new data--> series,model,sfx check in database if have field series ,model, sfx already insert z ,y, x…..last field-->sfx//
If (Request("savetypenew") ="บันทึก" ) then
If (Request("nmtypenew1") <> "") and (Request("nmtypenew2") <> "") and (Request("nmtypenew3") <> "") then
If (len(Request("nmtypenew1")) >= 12) and (len(Request("nmtypenew2")) >= 2) and (len(Request("nmtypenew3")) >= 1) then
// create array //
Cha = array
("Z","Y","X","W","V","U","T","S","R","Q","P","O","N","M","L","K","J","I","H","G","F","E","D","C","B","A")
//check if have--> series ,model, sfx//
sql = ""
sql = sql &"select count(MMT_MOD_SFX) as AMOUNT_SFX,count(MMT_SRS_CD) as AMOUNT_SRS,count(MMT_MOD_CD) as AMOUNT_MOD"
sql = sql &" from DSP_MOD_MST"
sql = sql &" where MMT_MOD_SFX = '"&Request("nmtypenew2")&"'"
sql = sql &" and MMT_SRS_CD= '"&Request("codetypenew1")&"'"
sql = sql &" and MMT_MOD_CD = '"&Request("nmtypenew1")&"'"
set rs = conn.execute(sql)
if not rs.eof then
Totalrecord = rs("AMOUNT_SFX")
for i = 0 to Cint(Totalrecord)-1
sql = ""
sql = "Select * From DSP_MOD_MST"
sql = sql & " Where MMT_SRS_CD = '" &Request("codetypenew1")& "' and"
sql = sql & " MMT_MOD_CD = '" &Request("nmtypenew1")& "' and"
sql = sql & " MMT_MOD_SFX = '" &Request("nmtypenew2")& "' and"
sql = sql & " MMT_FR_DT <= '"&DateNow&"' "
set rs = conn.execute(sql)
do while not rs.eof
rs.movenext
loop
//if data have already then insert and add z in field MMT_MOD_SFX value Request("nmtypenew2")&Cha(i)//
sql = ""
sql = "Insert Into DSP_MOD_MST"
…….
…….
sql = sql & " MMT_MOD_SFX,"
sql = sql & " Values ('"&Request("codetypenew1")&"' , "
…….
…….
sql = sql & " '"&Request("nmtypenew2")&Cha(i)&"' , "
end if
next
else
if data haven't already then normal insert not add z
Preaw
|
|
|
|
|
hi there,
i want to make a datagrid whose first column will be stable and rest columns can scroll horizontally.plz help me.
varuni
|
|
|
|
|