|
i have a column in datagrid that expose the company name....when the name of the company is long it is divided into multiple lines ...i want to force these lines to be one line and the remaining of the name is hide when the mouse over it, the remaining of the name appear
haitham
|
|
|
|
|
Hers a custom control you can use:
<br />
using System;<br />
using System.Web.UI.WebControls;<br />
<br />
namespace My.Controls{<br />
<br />
public class TruncLabel :Label {<br />
public TruncLabel() : base (){}<br />
<br />
protected override void Render(System.Web.UI.HtmlTextWriter writer){<br />
this.CssClass="fxS";<br />
this.ToolTip = this.Text;<br />
base.Render(writer);<br />
}<br />
}<br />
}<br />
Your stylesheet should then contain the following:
<br />
.fxS<br />
{<br />
overflow:hidden;<br />
white-space:nowrap;<br />
overflow-clip:rect(auto, auto, auto, auto);<br />
}<br />
The page containing the datagrid
<br />
<%@ Register TagPrefix="mi" Namespace="My.Controls" Assembly="MyProjectOrSomething" %><br />
.<br />
.<br />
asp:datagrid id="myDataGrid" runat="server" CssClass="grid" GridLines="None" AutoGenerateColumns="False"><br />
Columns><br />
asp:TemplateColumn HeaderText="Name" ItemStyle-VerticalAlign="Top"><br />
ItemTemplate><br />
mi:TruncLabel id="tlblName" Font-Bold="True" runat="server"><br />
<%#DataBinder.Eval(Container.DataItem, "strCompanyName").ToString()%><br />
mi:TruncLabel><br />
ItemTemplate><br />
asp:TemplateColumn><br />
Columns><br />
|
|
|
|
|
thanks for your reply
but can`t we use the ordinary label and change cssclass and tooltip properties of this label?..
i will try it and tell u
thanks again for your help....
haitham
|
|
|
|
|
Hello EveryBody,
I want to populate the dropdownlist from database,
but i am not able to set the categoryId as value
and categoryName as text in dropdownlist box.
Regards,
rahul saini
|
|
|
|
|
What problem when binding? Show your snippet of code???
<< >>
|
|
|
|
|
Hello
Thanks for your reply.
I am using following code:
string selectQuery = "SELECT * FROM Category ";
SqlConnection myConn = new SqlConnection(Application["Conn"].ToString());
SqlDataAdapter myAdapter = new SqlDataAdapter(selectQuery, myConn);
DataSet myDataset = new DataSet();
myAdapter.Fill(myDataset);
foreach (DataRow memberRow in myDataset.Tables[0].Rows)
{
ddlstCategoryList.Items.Add(memberRow["categoryName"].ToString());
}
I m getting the data but i want text as well as ite value.
regards
rahul saini
|
|
|
|
|
monuSaini wrote: foreach (DataRow memberRow in myDataset.Tables[0].Rows)
{
ddlstCategoryList.Items.Add(memberRow["categoryName"].ToString());
}
try to replace with this ddlstCategoryList.Items.Add(new ListItem("text","value");
you have to use another overrided method (with parameter is ListItem object)
<< >>
|
|
|
|
|
Thanks
It works.
But new problem has accoured.
After getting these categories I had another dropdown box.
And I want to have sub Categories with respact to selected category ID.
Can you help me.
I think it will be done with the help of java script.
Pls guide me
Regards
rahul saini
|
|
|
|
|
ok...is your subcategory stored in DB?
if so, you should use AJAX...below are steps:
- get the selected id of category by js
- based on the id call AJAX function to get list of subcategory acordingly
- populate to the second drop down list
Hope you get the idea
<< >>
|
|
|
|
|
Yes Thanks
But I had never used AJAX befor so can you please forward me some link from where i can get some practical idea .
regards
rahul saini
|
|
|
|
|
|
Hi
I m able to get the category id through javascript but
i m facing an problem in populating sub categpry with respact to categoryId in java script
Pls guide me
Regards
rahul saini
|
|
|
|
|
Did you follow the steps by steps how to do in AJAX?
Any problem when calling AJAX function?
<< >>
|
|
|
|
|
I think i really need to study AJAX .
No I had done it using OnSelectedIndexChanged attribute
Any way thanks for your guidence.
Regards
rahul saini
|
|
|
|
|
Okie...you're welcome
Happy coding
<< >>
|
|
|
|
|
Hi Friends,
I have a TextBox field in LoginView Control of the ASP 2.0 with TextMode="Password", I want to set its default value as we can set with TextMode="SingleLine". I tried but couldn't. anyone of you can help me in this?
Regards,
Abubakar
|
|
|
|
|
hi there:
Setting value for password textbox is different from normal...try below... txtpasswd.Attributes.Add("value", "the password we wish to set");
<< >>
|
|
|
|
|
Thanks,
I have done myself, here is code for that;
((TextBox)((Login)LoginView1.FindControl("LoginID")).FindControl("PasswordID")).Attributes.Add("value", "passsss");
|
|
|
|
|
One day I'll make an adult website with ASP.NET. Is is possible to make
an adult website with ASP.NET?
Anyone with suggestions?
Thanks in advance.
ASP - AJAX is SEXY. PERIOD.
|
|
|
|
|
Strange question....You can do anything with ASP.NET on the web
Mubashir
Every job is a self portrait of the person who did it.
|
|
|
|
|
Bulky Fellow wrote: adult website with ASP.NET?
Do you think ASP.NET is only for non adult websites ?
|
|
|
|
|
so stupid Question
tkml123
|
|
|
|
|
Im working on Webapplication in Visual C# .Net and have database Table for CategoryId,Category and CategoryImage...
i want to display when the user Add any Item in the Database and Choose anyCategory From Dropdown list it display the Respective picture for that Category
sheeba
|
|
|
|
|
Sheeba,
First make sure that your images are inside the application folder.
In your table which information on your categories have a column added with Path and add the path of the images only.
Now iam assuming you are using datagrid.
In your datagrid add a template column and in that add an image control,
datagrid
columns
templatecolumn
itemtemplate
image......
now in your image you can bind the name of the image which is in your database accordingly.
like: imagesource=<%#DataBinder.Eval(Container.DataItem, "path")%>
Try out, and it works for sure
Gautham
|
|
|
|
|
Sheeba,
First make sure that your images are inside the application folder.
In your table which information on your categories have a column added with Path and add the path of the images only.
Now iam assuming you are using datagrid.
In your datagrid add a template column and in that add an image control,
<datagrid>
<columns> <templatecolumn>
<itemtemplate>
<image......>
now in your image you can bind the name of the image which is in your database accordingly.
like: imagesource=<%#DataBinder.Eval(Container.DataItem, "path")%>
Try out, and it works for sure
Gautham
|
|
|
|