|
Make images column as a template column. Put image tag and set "src" to the value from data source.
|
|
|
|
|
Can you please give me a sample of that you wrote? What do you mean make images column as a template? i don't think i know how to make it a template column.
|
|
|
|
|
Hi
You can add more than one image control in your image template column and put image url what you want to display.
Thanks and Regards
Rasma
www.rasma.dom.ir
|
|
|
|
|
Is there a way to make an item in a dropdown list to be unselectable. What it means is that, it will show up in the dropdown however when users try to select it it will not be the selected item.
thanks.
|
|
|
|
|
try to make Enable = false
|
|
|
|
|
Maybe I donot know what you say.
Another way
1. change the Auto postback = true
2. add code DropDownList1_SelectedIndexChanged even
DropDownList1.Items.Add("a"); // a is the value of default.
DropDownList1.Items[this.DropDownList1.Items.Count - 1].Value = "";
DropDownList1.SelectedIndex = this.DropDownList1.Items.Count - 1;
|
|
|
|
|
Thank you for your response.
I think may be I have not explained what I really want to happen. Below is the senario.
The dropdown is populated during the page load with list items from a database. What I want is, for users not to be able select a specific item from the dropdown list. For instance let us say, the dropdwon contains, "apple, orange, peach" as its list items. I do not want the peach to be an item that can be selected by a user eventhough it is shown as an item in the dropdown.
Thanks for your help.
|
|
|
|
|
Ginbot7 wrote: I do not want the peach to be an item that can be selected by a user eventhough it is shown as an item in the dropdown.
If you don't want users to select it, why to show it there ? You can set "AutopostBack=true" for the drop down, handle selected index changed event, check selected item is the one which you need to prevent and show necessary messages.
|
|
|
|
|
You are absolutely right. In normal situations, no need to show it if it is not to be selected. However in our situation we want the item to be selected through code depending on another control result but should be non selecteble by the user.
e.g.
public void txtdate_textChanged(Object sender, Args e)
{
ddlfruits.selecteditem.text = "Peach";
}
|
|
|
|
|
Well, If you know the index of Peach , just set the SelectedIndex property.
ddlfruits.SelectedIndex = PeachIndex If not, iterate through each item, check the text is Peach , if yes make it selected.
ddlfruits.SelectedIndex = -1;
foreach (ListItem item in ddlfruits.Items)
{
if (item.Text == "Peach")
item.Selected = true;
}
|
|
|
|
|
|
|
Do they have examples ? Do they have forums ? There's a small number of peopel who are very active in this forum, and how do you know any of us even use this library ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
I have button which opens the dialog box to select a filename. the filename with path i am storing in textbox.
when i click on the button , i want to create one hyperlink and set its text and navigateurl property to textbox1.text.
i can able to create one hyperlink. but i want to create as many hyperlinks as button clicked by the user and textbox is not blank.
my code on button click event is
Dim HyperLink As HyperLink = Nothing
HyperLink = New HyperLink()
HyperLink.ID = "HyperLink" & i
HyperLink.Text = TextBox1.Text
HyperLink.NavigateUrl = "file:///" & TextBox1.Text
PlaceHolder1.Controls.Add(HyperLink)
PlaceHolder1.Controls.Add(New LiteralControl(" "))
This is working for one hyperlink , when i click on 2nd time button , the text changes to textbox1.text but it deletes the 1st hyperlink.
i tried Me.Controls.Add(New LiteralControl("<a href = " + HyperLink.NavigateUrl + ">" + TextBox1.Text + "</a>"))
but its not working.
Please help me as i am stuck here since one week. i dont know how to get rid of this problem.
i tried with ajaxextension, but i dont know how to use it.
one more thing i dont want to upload , i just want to attach this file to email. and if user wants to see this file he can click on hyperlink and he/she can open from the page and they can see the list of files that they have selected for the attachment.
Please help...with the code.
Thanks in advance.
Hemrk.
|
|
|
|
|
Does it post back to create the hyperlink ? THe postback is losing the dynamically created control because, well, it doesn't get recreated during te postback. You need to store the details of all the controls you created in viewstate so that on postback you recreate them all. Actually, you can just create links with javascript, if you know the URLs, from the textbox. No postback or AJAX needed.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
I have solved the problem using viewstate. so i didnt use any updatepanel and ajaxtoolkit stuff. it was so simple with viewstate.
|
|
|
|
|
Ok, first off, I am new to this and need a little help. I am trying to have an external web page open in a ContentArea of a ASPX page. I am using Master Pages for my web design, and I don't know how to have the external page (from another site) open in the content area. Please help.
Here is the code I have so far:
<asp:content id="Content1" contentplaceholderid="maincontent" runat="Server" xmlns:asp="#unknown">
|
|
|
|
|
Directly you can't open external page on a content place holder. Put an HTML IFrame in the content page and load the external page to there.
|
|
|
|
|
I have a GridView, which is associated with a sqldatasource.
Not every values retrived by the sqldatasource from the database table is displayed in the grid view.
From the code-behind (.aspx.cs), i want to access this data for every row and decide whether a button present in that row shall be visible/invisible.
Please help ...
Apurv
|
|
|
|
|
You can handle gridview's databind events like RowDataBound . You will get access to current row.
|
|
|
|
|
Thanks ....
its done ...
Apurv
|
|
|
|
|
I have a gridveiw that there is a button in every row of it.I want to when I click the button ,the item that is in a this row add to my shoppingcart.what code should I write for my gridview.
|
|
|
|
|
Write code for the click event of the button
When you bind the gridview, bind the CommandArgument of the button to the ID of the product of the corresponding row
In the code for the click event check the commandargument of the sender (the button) and do what you got to do to add the item to shopping cart
Alexei Rodriguez
|
|
|
|
|
hai all,
i want to display 'P' instead of date in single line in grid view.
Here P means Present.
i have 2 table named as employee details and attendance.
emp_id and emp_name are the 2 field names for employee details table.
emp_id and date1 are the 2 field names for attendance table.
values in attendance table are
emp_id--------date1
---11---------10-08-2008
---11---------11-08-2008
---11---------12-08-2008
here datatype is datetime for date1 field.
in attendance table, the date values (10-08-2008,11-08-2008,12-08-2008) are present date for emp_id 11.
in output side,i select employeename as ajay from employeenamedropdownlist,then i select fromdate as 09-08-2008,then i select todate as 13-08-2008,then i finally click submit button.
when i click submit button,the following output coming in grid view using my program
EmployeeID--EmployeeName--09-08-2008--10-08-2008--11-08-2008--12-08-2008--13-08-2008
---11--------------------Ajay------------------------------10-08-2008
---11--------------------Ajay------------------------------------------------11-08-2008
---11--------------------Ajay-------------------------------------------------------------------12-08-2008
but this output is wrong.
here 2 mistake.
1st mistake:
instead of 'P',displaying date in 3 lines.
P means Present.
2nd mistake:
Displaying 3 lines for same employeeid and employeename.
so i want to display 'P' instead of date in single line in grid view as follow
EmployeeID-----EmployeeName-----09-08-2008-----10-08-2008-----11-08-2008-----12-08-2008-----13-08-2008
---11-------------------Ajay-------------------------------------------P-------------------P--------------------P
how to do this?
here my program using C# in asp.net
protected void SubmitButton_Click(object sender, ImageClickEventArgs e)
{
from_date = fromdatetextbox.Text;
to_date = todatetextbox.Text;
emp_name = employeenamedropdownlist.SelectedValue;
check();
}
void check()
{
System.TimeSpan dt_diff = Convert.ToDateTime(to_date).Subtract(Convert.ToDateTime(from_date));
days = dt_diff.Days;
for (int i = 0; i <= days; i++)
{
sql_date = Convert.ToDateTime(from_date).AddDays(i).ToString("MM/dd/yyyy");
da = new SqlDataAdapter("select distinct a.emp_id as EmployeeID,a.emp_name as EmployeeName,min(case when b.date1='" + sql_date + "' then b.date1 end) as '" + sql_date + "' from employeedetails as a,attendance as b where a.emp_id=b.emp_id and b.date1='" + sql_date + "' group by a.emp_id,a.emp_name", con);
da.Fill(dt);
}
GV_musterrole.DataSource = new DataView(dt);
GV_musterrole.DataBind();
}
any other program(C# or VB.net) or any other logic or any other way is there.
|
|
|
|
|
Hi
I am trying to select distinct fields from a table.
The problem is some of them are still duplicating even with the distinct function there.
Why would this be?
Does the distinct function not work with every query?
|
|
|
|