Web Forms :: Can't Add Item To Different Dropdownlist By Passing Different Parameter?
Jan 12, 2010
call the method by passing parameter:
add_ddl_item_by_dt((DataTable)Session["dt_1"],ddl_1);
add_ddl_item_by_dt((DataTable)Session["dt_2"],ddl_2);
protected void add_ddl_item_by_dt(DataTable dt,DropDownList ddl)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
ddl.Items.Add(dt.Rows[i]["Field_1"].ToString());
}
}
why i cannot use the above method to add item to different dropdownlist by passing different parameter?
View 3 Replies
Similar Messages:
Nov 25, 2010
how to passing dropdownlist value as parameter to another page?
View 3 Replies
Feb 2, 2011
How to add blank item in dropdownlist without using appenddatabounditem after control parameter refresh?
View 1 Replies
Apr 6, 2010
I have a grid and dropdownlist.I want to filter values in a grid by the selection of dropdownlist.How Can i do this? My code is like this
[code]....
How can i pass the selected value of dropdown list to @VisitedVol .
View 3 Replies
Jul 9, 2010
I have a HyperLink control in a ListView, and I need to pass a couple of querystring parameters.
[Code]....
The first parameter is based on the current DataItem value in the LV.
Suppose I want to set a second parameter with a value from Selected.Item.Text in a DropDownList on the same page, how would the HyperLink look?
View 4 Replies
Jul 16, 2012
I bind dropdownlist in my page
protected void Page_Load(object sender, EventArgs e) {
BindDropDownList(DDL1, "city1", "name", "ID");
DDL1.Items.Insert(0, new ListItem("select city", "0"));
}
And SP
LTER procedure [dbo].[city1]
as
begin
select id,Name
from city
end
And design code
<asp:DropDownList ID="DDL2" runat="server" CssClass="daddsd">
</asp:DropDownList>
And here is imagebutton code that when click on it update data into table
protected void ImageButton_Click1(object sender, ImageClickEventArgs e) {
string data = Server.UrlDecode(Request.QueryString["BehCode2"]);
SqlCommand _cmd = new SqlCommand("insertinfo", _cn);
_cmd.CommandType = CommandType.StoredProcedure;
_cn.Open();
[Code] ....
Here when i click on button it insert all data into table but it didn't insert my selected item from dropdownlist it insert select city that i define in page_load
DDL1.Items.Insert(0, new ListItem("select city", "0"));
And when i delete this code from page load it insert in table first row of my table it didn't insert my selected item from dropdown list.
View 1 Replies
Aug 12, 2012
I have 2 dropdownlist in my page
1-ddlzone1
2-ddlstore1
What I need is if I select default item i.e. 0 in Zone dropdown I need to show all items in store dropdown. Below is my stored procedure to get the stores
ALTER procedure [dbo].[selectcenter]
@RegionID varchar(5)
as
begin
select ID,Centername
from Shoppingcenter
where RegionID=@RegionID
group by ID,Centername
end
View 1 Replies
Jul 10, 2010
I need to add an item in a dropdownlist and also modify the value of that item, but im getting an error : "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index"here's my Page load
Dim rt as new OleDbCommand("Select * from Question ", con)
dim rd as OleDbDataReader
rd = rt.ExecuteReader
Dim a as new OleDbCommand("Select Count (*) as C from Question" , con)
[code]...
View 2 Replies
Mar 17, 2011
I am opening one page and sending parameter from one asppage to other using winodow.open method
var retVal = window.showModalDialog("PopupWindow.aspx?SQL=" + document.getElementById(SUCName.concat("txtRetVal")).value +
"&Curr_Date=" + d , null,"dialogLeft=" + XPos + ";dialogTop=" + YPos +
";center=no;status=no;dialogHeight:430px;dialogWidth:420px;resizable=no;help=no");
in my document.getElementById(SUCName.concat("txtRetVal")).value contains:
SELECT ResourceID, ResourceName FROM ResourceMaster WHERE AREA LIKE '%CALICUT%'
but when it access this on PopupWindow.aspx using Request.QueryString("SQL") then first 3 character in LIKE clause gets convert to some ascii character and my query becomes
SELECT ResourceID, ResourceName FROM ResourceMaster WHERE AREA LIKE '�LICUT%'
what is solution to this?
View 7 Replies
Feb 12, 2011
i am doign url routing and it is working fine with url like followwing:-when ever i click on HOME/SEARCH i get redirected to ~/SEARCH1.aspx page.
[Code]....
BUT IF I REPLACE THE ABOVE URL WITH "~/SEARCH1.ASPX?ID=2"I GOT FOLLOWING ERROR:'~/search1.aspx?id=2' is not a valid virtual path. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.Web.HttpException: '~/search1.aspx?id=2' is not a valid virtual path.i have to pass id to the search1.aspx page.what is the way out.
View 5 Replies
Jan 20, 2011
Developing in C#.I have a home page and couple of other aspx pages.In the home page in a summary box I have names of projects. When the user clcks on a given project I will pass the projectID to the Project.aspx page.I then retrieve this ProjectID and display the project details in text boxes. Code is given below.
[Code]....
View 3 Replies
Oct 22, 2010
I have got a drop down list in a gridview and would like to pass eval() as parameter to javascript..
<asp:DropDownList ID="ddl_grprowcutter" runat="server" onchange='<%# "fn_ddl(" +Eval("Order_No") + " );" %>'
View 15 Replies
Jan 20, 2010
how to pass through a query string parameter of an assignment id and then checking and validating this as a number and displaying the information returned on screen. At present I have code which displays the information on screen but this is by entering in the assignment id and by triggering the button click event, I've shown the code for this below:
.aspx
<div>
<b>Current Assignment</b>
<br />
<asp:TextBox runat="server" ID="txtAssignmentID"></asp:TextBox>
<asp:Button runat="server" Text="Get Assignment" />
<br />
<b>Date Started:</b> <asp:Label runat="server" ID="lblAssignmentStart"></asp:Label>
<br />
<b>Status:</b> <asp:Label runat="server"></asp:Label>
<br />
<b>Current Achievement Level:</b> <asp:Label runat="server" ID="lblAssignmentLevel"></asp:Label>
<br />
<b>Date Last Calculated:</b> <asp:Label runat="server" ID="lblAssignmentCalcDate"></asp:Label>
<br />
</div>
.cs
protected void cmdGetAssignment_Click(object sender, EventArgs e)
{
//Check the assignmentID is an integer
int AssignmentID = 0;
try
{
AssignmentID = TypeConv.CInt(txtAssignmentID.Text);
}
catch
{
}
if (AssignmenttID > 0)
{
//Create new TCAAssignment object by passing the ID
TCA Assignment Current Assignment = abc.TCA Assignment (AssignmentID);
lblAssignmentStart.Text = Current Assignment.dDateCreated.ToString();
lblAssignmentStatus.Text = CurrentAssignment.rTCAAssignmentStatus.dDescription;
if (!CurrentAssignment.dTCAAchievementLevel.IsNull)
{
lblAssignmentLevel.Text = CurrentAssignment.rTCAAchievementLevel.dDescription;
}
lblAssignmentCalcDate.Text = CurrentAssignment.dAchievementDate.ToString();
}
}
Code example passing through a query string parameter of an assignment id would be great.
View 11 Replies
Mar 26, 2011
i am passing two parameter in javascript and open popup window.... but geeting mid value "undefined" here is my code:
<asp:TemplateField HeaderText="comments">
<ItemTemplate>
<a href="javascript:replycomments('<%# Eval("projectid")%>'),('<%# Eval("milestoneserial")%>')">Reply comments</a>
</ItemTemplate>
</asp:TemplateField>
and
function replycomments(id,mid)
{
window.open("replymilestone.aspx?id="+id+"&mid="+mid,"mypage","width=400,height=500,scrollbars=0,menu=0","");
}
this is working fine if i am passing single value like:
<asp:TemplateField HeaderText="comments">
<ItemTemplate>
<a href="javascript:replycomments('<%# Eval("projectid")%>')">Reply comments</a>
</ItemTemplate>
</asp:TemplateField>
and
function replycomments(id)
{
window.open("replymilestone.aspx?id="+id,"mypage","width=400,height=500,scrollbars=0,menu=0","");
}
View 1 Replies
Mar 16, 2010
i am using data grids on my web page, and on edititemtemplate i have custom validators for the drop down list ( ddl), most of them they do the same job which is to test if the user did select from the ddl or not.
i want to point all of these drop down lists to the same function and pass to this function the ddl.ClientID
how can i do this?
i tried this but it didn't work with me
[Code]....
[Code]....
[Code]....
View 2 Replies
Apr 7, 2010
I have a web form that has drop down controls. These controls are data bound to a database. Now, I would like the results of the selected values to be shown on a new aspx page in a gridview or detailsview.
View 3 Replies
Jun 15, 2010
I am using VS 2005 (asp.net 2.0). Currently i am facing a problem everytime onclick button call the popup it will refresh the page. Below is my code, Any suggestion or better idea can do it without refresh
[Code]....
View 2 Replies
Jul 7, 2010
I have a project that queries a set of times from a database and uses these entries to populate a dropdownlist. Once the page is loaded, the user can select one of the items in the DropDownList. When the "Save" button is clicked, the Selected item value is returned to the [HttpPost] version of the controller action. This item is then stored into session. If the system returns to the page containing the dropdown, I want the saved Value to be selected in the DropDownList. What actually happens is that the DropDownList is always set to be the first item in the list.
Database Table: This data has been imported using Link to SQL
[code]....
View 4 Replies
Feb 3, 2010
i use a dropdownlist in a page, with its items taken from a mysql database
i also use autopostback property...my problem here is that, every time i selecct an item, the first item in the list gets seelected
View 5 Replies
Sep 10, 2010
How do I pass the value from my menu item to my sql in the back code? Here's what I have so far.
[Code]....
and I need it passed to the ScheduleID so that it reloads the page with the new value parameter
[Code]....
View 3 Replies
Apr 26, 2010
input type=..... value="<%= ISO3166CountryList.GetCountryByCode("IE", CurrentLocale).Name %>" />
I'm looking to replace the hardcoded IE with something like
<%#(Container.DataItem as PhoneNumber).ISO%>
No variations of what I've tried worked. How can I get a databinded value when within a <%= code block? Do I need to use an intermediary variable?
View 2 Replies
Aug 26, 2010
I am using url in my mvc application like /product/edit/5, should change it because users can
change id parameter and access different product as this Id directly refer to Id in product table, I have validation there for user to access product.
should I continue with it or should I change it as application has many users
View 2 Replies
Oct 4, 2010
Passing dynamic value to Detail view of grid through object selecting parameter
View 4 Replies
Aug 31, 2010
I have a Formview ('formview1') with a pager. I also have a gridview ('gridview1') linked to a SQL datasource ('History'). I need to set the SelectParameter ('Serial') of the datasource to be the value of a field on the current page in the formview. The value i need to get is in the ItemTemplate and is a label called 'SerialNumberLabel'. So, something like:
<SelectParameters>
<asp:ControlParameter Text = "Eval fromview1.currentpage.itemtemplate.SerialNumberLabel" >
I also need to ensure that the SQL source and gridview rebind when the pager is activated.
View 5 Replies
Sep 12, 2010
How do I pass the value selected from the dropdownlist to my sql code in the back?
View 8 Replies