|
your code seems to be fine.... jus check whether u have values in the database......
|
|
|
|
|
Make sure you have wired the event up properly in your aspx page, i.e.
<asp:dropdownlist id="DropDownList2" runat="server" autopostback="true" onselectedindexchanged="DropDownList2_SelectedIndexChanged">
Also, put a breakpoint at the start of your DropDownList2_SelectedIndexChanged method to see if it is being called at all.
|
|
|
|
|
Is the AutoPostBack property of that dropdown set to True?
MP
|
|
|
|
|
|
i have done the same thing which u want i just use daset instead of datareader try it
protected void Page_Load(object sender, EventArgs e)
{
DAL Helper = new DAL();
Helper.ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|Coupon Management.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True";
string query = "select CouponName from CouponType";
ds = Helper.ExecuteDataSet(CommandType.Text, query, null);
if (!IsPostBack)
{
ddlCType.DataSource = ds;
ddlCType.DataValueField = "CouponName";
ddlCType.DataTextField = "CouponName";
ddlCType.DataSourceID = String.Empty;
}
}
protected DataSet GetData(string sqlCommand)
{
da1 = new SqlDataAdapter(sqlCommand, cnx );
ds = new DataSet();
da1.Fill(ds );
return ds ;
}
protected void DropDownList1_TextChanged(object sender, EventArgs e)
{
cnx.Open();
SqlCommand ddlcmd = new SqlCommand();
commandText = "SELECT MAX(CouponTransaction.SerialEnd),CouponType.Price FROM CouponType INNER JOIN CouponTransaction ON CouponType.CouponTypeID = CouponTransaction.CouponTypeID WHERE CouponType.CouponName= '" + ddlCType.SelectedValue + "'GROUP BY CouponType.Price";
ds = new DataSet();
ds = GetData(commandText);
if (ds.Tables[0].Rows.Count!=0 )
{
txtSFrom.Text = ds.Tables[0].Rows[0][0].ToString();
Txtprice.Text = ds.Tables[0].Rows[0][1].ToString();
cnx.Close();
}
}
|
|
|
|
|
thanks ....
|
|
|
|
|
|
hi
I have windows vista and
when I debug my website project in visual studio,
my browser doesn't run.
after that i checked my IIS in control panel but again browser doesn't work.
THX.
|
|
|
|
|
you mean to say, You are not able to debug Asp.Net application?
|
|
|
|
|
HI
Thanks for your attention
I mean that when i debug my website,IE said "can not find server".
|
|
|
|
|
i have a dropdownlist which a different values on its textchanged i want to populate two textboxs. one to show Maximum Serial end and another show Serial End.
when i select 3 value in textbox it works as i like. but other than 3 i slect any value it show error There is not row at position 0
protected void DropDownList1_TextChanged(object sender, EventArgs e)
{
cnx.Open();
SqlCommand ddlcmd = new SqlCommand();
commandText = "SELECT MAX(CouponTransaction.SerialEnd),CouponType.Price FROM CouponType INNER JOIN CouponTransaction ON CouponType.CouponTypeID = CouponTransaction.CouponTypeID WHERE CouponType.CouponName= '" + ddlCType.SelectedValue + "'GROUP BY CouponType.Price";
ds = new DataSet();
ds = GetData(commandText);
txtSFrom.Text =ds.Tables[0].Rows[0][0].ToString();
Txtprice.Text = ds.Tables[0].Rows[0][1].ToString();
cnx.Close();
}
|
|
|
|
|
ds = new DataSet();
ds = GetData(commandText);
if(ds.rows.count !=0)
{
txtSFrom.Text =ds.Tables[0].Rows[0][0].ToString();
Txtprice.Text = ds.Tables[0].Rows[0][1].ToString();
}
cnx.Close();
|
|
|
|
|
it show error in if statement that Doesn't contain definition for Rows"
|
|
|
|
|
sorry,
change it as
if(ds.Tables[0].Rows.count)
|
|
|
|
|
thnx its working thank u very much
|
|
|
|
|
I suggest you to always check count before fetching indexed elements.
if(ds.Tables.count >0)
{
if(ds.Tables[0].Rows.count > 0)
{
if(ds.Tables[0].Columns.Count >=2)
{
txtSFrom.Text = ds.Tables[0].Rows[0][0].ToString();
Txtprice.Text = ds.Tables[0].Rows[0][1].ToString();
}
}
}
like this.
|
|
|
|
|
|
Cheers
|
|
|
|
|
Hi all,
Im checking the password strength using JS. It works fine in IE but not in Mozila . Can any one solve my problem please. Here is the script.
<script language="javascript" type ="text/javascript">
function check_password_safety(pwd)
{
var msg = "";
var len= pwd.length;
var i;
var has_letter = new RegExp("[a-z]");
var has_caps = new RegExp("[A-Z]");
var has_numbers = new RegExp("[0-9]");
var has_symbols = new RegExp("\\W");
var pointsLetter=0;
var pointsCaps=0;
var pointsNumbers=0;
var pointsSpecials=0;
for(i=0;i<len;i++)
{
var x=pwd.charAt(i);
if(has_letter.test(x))
{
++pointsLetter;
}
else if(has_caps.test(x))
{
++pointsCaps;
}
else if(has_numbers.test(x))
{
++pointsNumbers;
}
else if(has_symbols.test(x))
{
++pointsSpecials;
}
}
if(len>6)
{
if(pointsLetter>0 && pointsCaps==0 && pointsNumbers==0 && pointsSpecials==0 && len>12)
{
password_info.innerHTML = "Very Week";
password_info.className='Style_VeryWeek';
}
if(pointsLetter>0 && pointsCaps==0 && pointsNumbers==0 && pointsSpecials==0 && len<12)
{
password_info.innerHTML = "Week";
password_info.className='Style_Week';
}
if(pointsLetter==0 && pointsCaps==0 && pointsNumbers>0 && pointsSpecials==0)
{
password_info.innerHTML = "Week";
password_info.className='Style_Week';
}
if(pointsLetter==0 && pointsCaps>0 && pointsNumbers==0 && pointsSpecials==0)
{
password_info.innerHTML = "Week";
password_info.className='Style_Week';
}
if(pointsLetter==0 && pointsCaps==0 && pointsNumbers==0 && pointsSpecials>0)
{
password_info.innerHTML = "Week";
password_info.className='Style_Week';
}
if(pointsLetter>0 && pointsCaps==0 && pointsNumbers>0 && pointsSpecials==0)
{
password_info.innerHTML = "Medium";
password_info.className='Style_Medium';
}
if(pointsLetter>0 && pointsCaps==0 && pointsNumbers==0 && pointsSpecials>0)
{
password_info.innerHTML = "Strong";
password_info.className='Style_Strong';
}
if(pointsLetter>0 && pointsCaps>0 && pointsNumbers==0 && pointsSpecials==0)
{
password_info.innerHTML = "Medium";
password_info.className='Style_Medium';
}
if(pointsLetter>0 && pointsCaps>0 && pointsNumbers>0 && pointsSpecials==0)
{
password_info.innerHTML = "Strong";
password_info.className='Style_Strong';
}
if(pointsLetter>0 && pointsCaps>0 && pointsNumbers==0 && pointsSpecials>0)
{
password_info.innerHTML = "Strong";
password_info.className='Style_Strong';
}
if(pointsLetter>0 && pointsCaps>0 && pointsNumbers>0 && pointsSpecials>0)
{
password_info.innerHTML = "Very Strong";
password_info.className='Style_VeryStrong';
}
if(pointsLetter>0 && pointsCaps==0 && pointsNumbers>0 && pointsSpecials>0)
{
password_info.innerHTML = "Very Strong";
password_info.className='Style_VeryStrong';
}
}
else
{
if(len!=0)
{
password_info.innerHTML ="Minimum Length 6 Charecters";
password_info.className='Style_Minimum';
}
else
{
password_info.innerHTML ="Type Password";
password_info.className='Style_Normal';
}
}
}
</script>
|
|
|
|
|
if i am not wrong!!!!! some of the script will not work in Mozila.....
|
|
|
|
|
First try to find out with the help of Alert() that which line of code is not working so can easily help you.
|
|
|
|
|
there is nothing written wrong in the code. The only thing that comes into my notice is
password_info.innerHTML
Always remove the existing childelements before you set the innerHTML, so that if there is any child elements present, IE will throw an error.
Use like this :
function setContent(container, content) {
if (!!container) {
while (container.firstChild)
container.removeChild(container.firstChild);
var dummyDiv = document.createElement('div');
dummyDiv.innerHTML = content;
container.appendChild(dummyDiv);
}
}
Now call setContent(password_info,"yourhtml")
On your problem, I think there must be problem somewhere else. Check Mozilla Error Console for that entry.
|
|
|
|
|
please help me to how load the image into modal popup from DataList
i coded as below but it didn't work
<table cellpadding="0" cellspacing="0">
<tr><td><asp:DataList ID="dlPartner" runat="server" RepeatDirection="Horizontal"
RepeatColumns="5">
<ItemTemplate>
<table cellpadding="5" cellspacing="20" border="0">
<tr><td>
<table>
<tr><td>
<asp:ImageButton ID="imgLogo" ImageUrl='<%#"~/Data/"+Eval("Logo")+"" %>' runat="server" CommandArgument='<%#Eval("ID") %>' OnCommand="imgLogo_Click"/>
</td></tr>
<tr><td align="center">
<asp:Label Text='<%# Eval("Name") %>' runat="server" CssClass="partnerDataListFormatting" Font-Bold="true"></asp:Label>
</td></tr>
<tr><td align="center">
<asp:Label Text='<%# Eval("Country") %>' runat="server" CssClass="partnerDataListFormatting"></asp:Label>
</td></tr>
</table>
</td></tr>
</table>
</ItemTemplate>
</asp:DataList></td></tr>
<tr><td><asp:Label ID="lblInfo" runat="server"></asp:Label>
</td></tr>
<tr><td><asp:Panel ID="pnlPopup" runat="server" CssClass="ModalPopupBG">
<div>Hello world</div>
</asp:Panel></td></tr>
<tr><td><asp:Button ID="btnHiddenClickToModalPopUp" runat="server"
Text="CLick" />
<cc1:ModalPopupExtender ID="ModalPopupExtender1" TargetControlID="btnHiddenClickToModalPopUp" PopupControlID="pnlPopup" runat="server"
DropShadow="true">
</cc1:ModalPopupExtender></td></tr>
</table>
</td>
</tr>
</table>
|
|
|
|
|
123chaminda wrote: coded as below but it didn't work
you havn't metioned the error what you are getting....
|
|
|
|
|
hii all...
i hav populated a dropdownlist at pageload.
now i have textbnox i want to display the name in textbox according to the id selected in the dropdown list.Initially when pageloads it
displays the name in textbox according to the value in the dropdown but when i change the item in the dropdown it not works.The textbox value does not change.plz guide me.also i hav made the autopostback property of dropdown true.the code is:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
PopulateDDL1();
string str = "Select * From Vendor Where(VendorID='" + DropDownList1.SelectedValue + "')";
SqlCommand cmd = new SqlCommand(str, conn);
SqlDataReader dr = null;
conn.Open();
dr = cmd.ExecuteReader();
while (dr.Read())
{
TextBox1.Text = dr["VendorName"].ToString();
}
conn.Close();
}
}
public void PopulateDDL1()
{
SqlCommand cmd = new SqlCommand("Select * From [Vendor]", new SqlConnection(ConfigurationManager.ConnectionStrings["BillingSystem"].ConnectionString));
cmd.Connection.Open();
SqlDataReader dr;
dr = cmd.ExecuteReader();
DropDownList1.DataSource = dr;
DropDownList1.DataValueField = "VendorID";
DropDownList1.DataTextField = "VendorID";
DropDownList1.DataBind();
cmd.Connection.Close();
}
|
|
|
|