|
I have been battling with setting gridview column width. Can some one help me out? I have a gridview that is bound to a datatable. Im using a session object as the datasource to my datatable and i want the gridview column width to be set to some value. Below are my various trial
Protected Sub grdDetails_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles grdDetails.RowDataBound
'If e.Row.RowType = DataControlRowType.Header Then
' 'If e.Row.RowType = DataControlRowType.DataRow Then
' 'e.Row.Cells(0).Width = New Unit(1400, UnitType.Pixel)
' 'e.Row.Cells(1).Width = CInt(Server.HtmlDecode(2400))
' e.Row.Cells(0).Attributes.Add("style", "width: 100px;")
' e.Row.Cells(1).Attributes.Add("style", "width: 100px;")
'End If
'grdDetails.Columns(1).ItemStyle.Width = CInt(Server.HtmlDecode(1400))
'grdDetails.Columns(2).ItemStyle.Width = CInt(Server.HtmlDecode(2400))
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.Cells(0).Text = Date.Parse(e.Row.Cells(0).Text).ToString("d")
'format the numeric values
For j As Integer = 3 To 5
e.Row.Cells(j).CssClass = "ralign" 'Amount Col
e.Row.Cells(j).Text = Decimal.Parse(e.Row.Cells(j).Text).ToString("n")
Next
'ElseIf e.Row.RowType = DataControlRowType.Footer Then
' 'display summary data in the appropriate cell
' e.Row.Cells(4).Text = "Total :"
' e.Row.Cells(5).Text = GetTotal().ToString("n")
End If
End Sub
any help will be appreciated
|
|
|
|
|
Hi dear,
First u tell me in yr grid AutoGenerateColumn is set to true or false??
regards,
Rana Krishnraj
|
|
|
|
|
autogeneratecolumn is set to false
|
|
|
|
|
That means u have to right the code like this :
Note: below code is exa. purpose only.
<asp:gridview....
<Columns>
<asp:BoundColumn DataField="tid" HeaderStyle-Width="5%" HeaderText="Id" >
<ItemStyle Width="5%" />
</asp:BoundColumn>
<asp:BoundColumn DataField="tName" HeaderStyle-Width="15%" HeaderText="Keywords" ReadOnly="True">
<ItemStyle Width="15%" />
</Columns>
Hope u get an idea.......
best of luck
regards,
Rana Krishnraj
|
|
|
|
|
its not working yet. there is no asp:BoundColumn. I used asp:BoundField yet its not working
|
|
|
|
|
Try This on Page Load
GridView1.Attributes.Add("style", "word-break:break-all;word-wrap:break-word")
Roopali Gupta
ad
|
|
|
|
|
Hi,
i am developing a page having a grid view. For one system it is displaying the gridview properly... but in other system the same grid view is not displayed properly.. i could find that the first row of the gridview overlap with the header...
both the machines are having IE7
Thnkx in advance....
plz find the ASp.net code fr the grid view
<br />
<br />
<div style="overflow:scroll;" id="GridDiv" ><br />
<asp:GridView ID="GrdSeverity" runat="server" AutoGenerateColumns="False" Width="90%" ><br />
<Columns><br />
<asp:BoundField HeaderText = "Index" DataField="Index" SortExpression = "Name"><br />
<ItemStyle HorizontalAlign="Center" /><br />
</asp:BoundField><br />
<br />
<asp:HyperLinkField HeaderText="Name" Text="Name" DataTextField = "Name" DataNavigateUrlFields = "NavSeverity"><br />
<br />
</asp:HyperLinkField><br />
<br />
<asp:BoundField HeaderText="Description" DataField = "Description"><br />
<br />
</asp:BoundField><br />
<br />
</Columns><br />
<br />
<HeaderStyle BackColor="#FFC0FF" /><br />
<br />
</asp:GridView><br />
</div><br />
<br />
Regards,
Rajasekaran
|
|
|
|
|
Is in both IE the sign size the same?
What about an ItemStyle-Width="...PX" ?
|
|
|
|
|
Hi,
I am asked to do an user control which takes the input for the PageSize
and PageNumber.The User control also has a button on clicking which would set the PageSize and Page Number of a Grid.Grid is not part of a user control.
If a Page has a Grid control and my user control is registered in it.
How should I be doing this?I need an approach.Do I need to raise an event
from user control which will be captured by the page containg grid.
So that I can do databinding in that by assigning the values of pageSize and Page Index from User Control.
Any suggestions or links would be helpful.
Thanks
Today is a gift, that's why it is called the present.
|
|
|
|
|
|
You may need to use delegates. Raise an event from the user control when button is clicked. The page has to handle the event and do necessary bindings.
|
|
|
|
|
Right, sticky little problem. I have a standard upload form in my web app, and I need to protect against people trying to upload massive files and getting crappy responses back. I'm catching the error in the Application_BeginRequest event by checking the inputStream, but here's my problem; If I do a response.Redirect to a URL with a meaningful error message, the application still won't display the page, as the massive HTMLStream is still there (at least I think that's what's happening. I've artificially triggered the redirect with a smaller file size, and it works, so it must be something to do with the size of the request).
I've tried using context.items.Clear(), but to no avail. also, a Server.transfer is not an option, because all the pages in the application inherit from a base page class that uses loads of session stuff, and server.transfer seems to lose all session information. So every way I turn I come up against a brick wall.
Does anybody have any ideas? If there was some way to do a server.transfer while preserving session state without preserving the input request stream, I think that would do it. But I can't see a way to do it.
Smokie, this is not 'Nam. This is bowling. There are rules.
|
|
|
|
|
You could run the upload-part (the source that is run when the button is clicked) in another tread. when you want to stop you could Kill the other thread and then do your server.transfer.
|
|
|
|
|
melchizidech wrote: I have a standard upload form in my web app, and I need to protect against people trying to upload massive files and getting crappy responses back. I'm catching the error in the Application_BeginRequest event by checking the inputStream
I am not getting why you chose application_beginrequest for this ? I guess you need to do the checking in the uploader form itself. Check the FileUpload1.PostedFile.ContentLength property to check for files.
|
|
|
|
|
i have used a datalist control and data bounded.in that i have used
asp:Literal to display text.the width of datalist 730px and cant more width. When i showing data in literal control it doesn't show all text.i want to show all text in that control. are their any ways/tips to display all my text in one controls.
|
|
|
|
|
hi,
you better use an HTML DIV tag inside your literal text value and set it's overflow mode to scroll. then it'll show the data in a scrollable manner.
e.g.
assign the control from datagrid to a local variable(object in this case) ans then set its value to your text keeping that text inside DIV tag
label1.text="<div id='oDiv' style='width: 200px; height: 200px; overflow: auto;'>" + "YOUR TEXT HERE" + "</div>"
Regards,
Ashish Sehajpal
|
|
|
|
|
I have to create a MS - Word document with header and footer from a HTML string. I am using the below code.
Dim strHTML As String = "<html><body><br><b>hello</b><br></body></html>"
Response.Cache.SetExpires(DateTime.Now.AddSeconds(1))
Response.Clear()
Response.AppendHeader("content-disposition", "attachment;filename=FileName.doc")
Response.Charset = ""
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.ContentType = "application/vnd.ms-word"
Me.EnableViewState = False
Response.Write("\r\n")
Response.Write(HttpUtility.HtmlDecode(strHTML))
Response.End()
I want to build the HTML with header and footer which will be later converted into a MS Word with Header and Footer also if the pages got increased.
Please help me out.
|
|
|
|
|
Hi All.
I am working on asp.net project where my company already two different domain
1.auds.aud.edu for (student)
2.auda.aud.edu for (staff)
my system is in auda.aud.edu domain.
all user details are in active directory and we have two different active directory for auda and auds domain
my local pc is connected to auda domain and my projecte running under vs2005 with windows xp pro.
i am authenticating users using active directory .its working fine it only authenticating LDAP://auda.aud.edu users becs my PC is under auda domain.how can i connect to auds.aud.edu domain if i give the ldap path like LDAP://auds.aud.edu or LDAP://<servername>/DC=auds,DC=aud,DC=edu all i tried not working i am able to ping the <servername> from my mechine but i cannot access the active directory users from my PC
pls help how can i solve this
|
|
|
|
|
in template columns i can use the container.dataitemindex + 1,
if i have to use the bound fields , and in the first column , i have to make it an autogenerate column, for serial no , how should i do that ?
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
What dou you mean by Autogenerate column? You mean you need to fill up a ColumnHeader with "Serial no" as text, which can be set by the HeaderText proerty of a databound field ?
|
|
|
|
|
hi,
currently i m using ASP.NET with C# (.net 2005, 2.0 framework).
here currently i m trying to backup of my project.
when i copy my project and paste in another location, the changes are affecting the
backup also.
how to rectify it? - KARAN
modified on Tuesday, April 1, 2008 1:46 AM
|
|
|
|
|
It may not be affeting your back up how ever your solution file may be still pointing to the original one.. Is that the case ?
Thanks
Laddie
Kindly rate if the answer was helpful
|
|
|
|
|
|
Hi anybody know about downloading folder??
i have a code for downloading file.but i need code for downloading folder.
im using asp.net2.0 with c#
Nothing is Impossible. Keep always Smiling...
|
|
|
|
|
Only 1 file can be downloaded at a time, so you can't download a whole folder of files in 1 go.
You could zip your files into a single archive and make that available for download though.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|