|
namespace HakhamaneshControl
{
[ToolboxData("<{0}:Drp_Languages runat=server></{0}:Drp_Languages>")]
public class Drp_Languages : DropDownList
{
protected override void RenderContents(HtmlTextWriter output)
{
output.RenderBeginTag(HtmlTextWriterTag.Option);
output.AddAttribute(HtmlTextWriterAttribute.Value, "Ar");
output.Write("Ar");
output.RenderEndTag();
}
}
}
///
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="CreateCustomControl._Default" %>
<%@ Register Assembly="ServerControl1" Namespace="HakhamaneshControl" TagPrefix="cc2" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
<div>
<cc2:Drp_Languages ID="hhhh" runat="server">
</cc2:Drp_Languages>
</div>
</form>
</body>
</html>
//code behind
protected void Button1_Click(object sender, EventArgs e)
{
Response.Write(DropDownList1.SelectedItem.Value.ToString());// null refrence exception
}
|
|
|
|
|
try this way
Response.Write(DropDownList1.SelectedValue.ToString());
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
unfortunately don't work. I think ,I must add items in a different manner. but I don't know how.
|
|
|
|
|
unfortunately don't work. I think ,I must add items in a different manner. but I don't know how.
|
|
|
|
|
I need a dropdownlist with 3 items. I use this dropdownlist in each page in my project.
how can I inherit from DropDownList control and add these items to it?
|
|
|
|
|
i have 3 link button, and i want set the text for them,
i set their name from database and i want use from (for) how can i do this?
LinkButton lkb1 = new LinkButton();
LinkButton lkb2 = new LinkButton();
LinkButton lkb3 = new LinkButton();
for (int j = 1; j <= 5;j++)
{
lkbj.text = ds.tables[0].rows[0][1].tostring();
}
|
|
|
|
|
LinkButton _button = null;
for (int count = 1; count < 5; count++)
{
_button = new LinkButton();
button .text = ds.tables[0].rows[count][1].tostring();
}
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
LinkButton lkb = null;
for (int j = 1; j <= 5;j++)
{
lkb = new LinkButton();
lkb.Text = ds.Tables[0].Rows[0][1].ToString();
YourContainerControl.Controls.Add(lkb);
}
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
Hi everybody,
I need to disable a ComboBox after clicking a button. I set the Enabled property to false at Click Event of button,
but it didn't work (because it needs a postBack)
I want to do this after clicking the button and doing sth (if succeed), so I can't do it in Page_Load.
What should I do?
Best wishes
|
|
|
|
|
mehrdadc48 wrote: What should I do?
Do it at the client side using Java script.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
How can I deal with standard DropDownList in javascript (in client event of another control. not itself)?
Best wishes
|
|
|
|
|
use javascript
/// write this script function in Body or form tag
function setcomboDisable()
{
document.getElementById('comboid').disabled="disabled"
return false;
}
///in page_load event
buttonid1.Attributes.Add("onclick","if(setcomboDisable()==false){ return false;}else { return true;}");
okay i hope it will work
|
|
|
|
|
hello there.. i wanna ask you how to use radio button in datagridview and display a record but not in single record.. for example i have two result of query :
First Result :
id name price category
A-1 a $20 cotton
A-2 c $50 nylon
Second Result
A-3 b $40 clothes
A-4 d $70 t-shirt
now iam going to combine and sum the price base on a-b b-c
how to combine it? and how to place a radio button beside it.
so i have a view like this
id name category price
A-1 a cotton (Radio Button)$60
A-3 b clothes
A-2 c nylon (Radio Button)$120
A-4 d t-shirt
and now user should select desired item from its prices using just one radio button beside the accumulate price..and view the result they selected in the next page i need a sample code in visual basic .net
|
|
|
|
|
tarbanhud wrote: i need a sample code in visual basic .net
This is so rude. No one here has time to write code for you.
People can suggest you how to proceed and if you have any further problems you can comeback and ask.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
i mean maybe anyone who has similar problem and then find reference on the net.. or maybe anyone
|
|
|
|
|
hi to all
sir please tell me how to upload any .aspx file in by file software as i uploaded html file but culd not upload any .aspx file in httpdocs.we can upload any folder in httpdocs or not if yes please provide me
rizvan sivally
|
|
|
|
|
sheemap wrote: sir please tell me how to upload any .aspx file in by file software as i uploaded html file but culd not upload any .aspx file in httpdocs.
I didn't understand what you are talking about . Can you please little bit of clear.
|
|
|
|
|
till now i uploaded html file in httpdocs i could not upload any folder(project name of aspn.net which include many aspx page) or any asp.x page
please how to upload any file or folder which contains asp.net file
rizvan sivally
|
|
|
|
|
hey .... u mean .... u r deploying ur website ???
Apurv
“Never trust a computer you can’t throw out a window.”
(Steve Wozniak)
“There are only two industries that refer to their customers as ‘users’.”
(Edward Tufte)
|
|
|
|
|
YES
I MEAN TO DEPLOYING
hi to all
sir please tell me how to upload any .aspx file in by file software as i uploaded html file but culd not upload any .aspx file in httpdocs.we can upload any folder in httpdocs or not if yes please provide me
rizvan sivally
|
|
|
|
|
have u pre-compiled ur code ???
Apurv
“Never trust a computer you can’t throw out a window.”
(Steve Wozniak)
“There are only two industries that refer to their customers as ‘users’.”
(Edward Tufte)
|
|
|
|
|
You have asked this question several times. Stop reposting
only two letters away from being an asset
|
|
|
|
|
Hi There,
I have a menu tree which i am loading using XMl.
When I run project from my IIS server on another machine then my menu tree gets loaded properly but when I run it on Web Server then that Menu Tree doesn't get loaded.What is the problem can anybody tell me.
Thanks,
Life Is Beautifull
|
|
|
|
|
ais07 wrote: i am loading using XMl
ais07 wrote: When I run project from my IIS server on another machine then my menu tree gets loaded properly but when I run it on Web Server then that Menu Tree doesn't get loade
What do you mean by running from IIS server and from Web Server ?
|
|
|
|
|
Thanks for your reply.
IIS Server means my local machine from which I am running my project and it works properly and my menu tree gets loaded properly from data base.But when I host same project on web server on net that time it runs properly but only menu tree doesn't get loaded.And in both the condition I am using same database which present on remote database server.
Thanks,
Life Is Beautifull
|
|
|
|