|
Hi,
I have two problems formatting my gridview:
1) In IE7 the gridview doesn't show underlines for the headertext in the gridview - in Firefox it is shown.
2) In Firefox the gridlines for Columns are shown. In IE7 they are gone.
I need it so, that I get the underlines for the headertext in IE7 and that the gridlines for the columns are not shown in Firefox.
I cann't figure out, wich settings I need to make, to make this happens.
I hope somebody can help me.
My code for the gridview are:
<asp:GridView SkinID="GeneralView" ID="grdEmployeeList" runat="server" DataKeyNames="employeeId" OnRowCommand="grdEmployeeList_RowCommand" OnPageIndexChanging="grdEmployeeList_PageIndexChanging" OnRowDataBound="grdEmployeeList_RowDataBound" OnSorting="grdEmployeeList_Sorting" AutoGenerateColumns="False" Width="850px" AllowPaging="True" PageSize="3" AllowSorting="True"><br />
<Columns><br />
<asp:BoundField DataField="employeeId" HeaderText="Bruger id" SortExpression="employeeId"><br />
<HeaderStyle Width="70px" BorderStyle="None" ForeColor="#FFFFFF" Font-Underline="true" BorderWidth="0px" BorderColor="#2F5673" Font-Bold="true" HorizontalAlign="Left" Height="25px" BackColor="#2F5673" /><br />
<ItemStyle BorderStyle="None" BorderWidth="0" BorderColor="Transparent" /><br />
</asp:BoundField><br />
<asp:BoundField DataField="employeeName" HeaderText="Brugernavn" SortExpression="employeeName"><br />
<HeaderStyle Width="150px" BorderStyle="None" ForeColor="#FFFFFF" Font-Underline="true" BorderWidth="0px" BorderColor="#2F5673" Font-Bold="true" HorizontalAlign="Left" Height="25px" BackColor="#2F5673" /><br />
<ItemStyle BorderStyle="None" BorderWidth="0" BorderColor="Transparent" /><br />
</asp:BoundField><br />
<asp:BoundField DataField="employeeType" HeaderText="Brugertype" SortExpression="employeeType"><br />
<HeaderStyle Width="200px" BorderStyle="None" ForeColor="#FFFFFF" Font-Underline="true" BorderWidth="0px" BorderColor="#2F5673" Font-Bold="true" HorizontalAlign="Left" Height="25px" BackColor="#2F5673" /><br />
<ItemStyle BorderStyle="None" BorderWidth="0" /><br />
</asp:BoundField><br />
<asp:TemplateField><br />
<ItemTemplate><br />
<asp:ImageButton ID="ibtnDeleteEmployee" runat="server" CommandArgument='<%# Eval("employeeId")%>' CommandName="DeleteEmployee" ImageUrl="../Images/Delete.gif" OnClientClick="return confirm('Er du sikker på, du vil slette produktet?');" /><br />
</ItemTemplate><br />
<HeaderStyle Width="80px" BorderStyle="None" ForeColor="#2F5673" Font-Underline="true" BorderWidth="0px" BorderColor="#2F5673" Font-Bold="true" HorizontalAlign="Left" Height="25px" BackColor="#2F5673" /><br />
<ItemStyle HorizontalAlign="Center" BorderStyle="None" BorderWidth="0" /><br />
</asp:TemplateField><br />
<asp:TemplateField><br />
<ItemTemplate><br />
<asp:ImageButton ID="ibtnShowEmployee" runat="server" CommandArgument='<%# Eval("employeeId")%>' CommandName="ShowEmployee" ImageUrl="../Images/Vis.gif" /><br />
</ItemTemplate><br />
<HeaderStyle Width="80px" BorderStyle="None" ForeColor="#2F5673" Font-Underline="true" BorderWidth="0px" BorderColor="#2F5673" Font-Bold="true" HorizontalAlign="Left" Height="25px" BackColor="#2F5673" /><br />
<ItemStyle HorizontalAlign="Center" BorderStyle="None" BorderWidth="0" /><br />
</asp:TemplateField><br />
</Columns><br />
<PagerTemplate><br />
<table border="0" cellpadding="0" cellspacing="0" style="width: 100%"><br />
<tr><br />
<td id="firstcell" runat="server" colspan="4" style="text-align: right; border-top-style: none; border-top-width: 0px;"><br />
<asp:Label ID="Label2" runat="server" CssClass="pagingtext" Text="Viser"></asp:Label> <asp:Label ID="LabelStartRowNo" runat="server" CssClass="pagingtext" Text=""></asp:Label><asp:Label ID="Label3" runat="server" CssClass="pagingtext" Text="-"></asp:Label><asp:Label ID="LabelEndRowNo" runat="server" CssClass="pagingtext" Text=""></asp:Label> <asp:Label ID="Label4" runat="server" CssClass="pagingtext" Text="af"></asp:Label> <asp:Label ID="LabelRowCount" runat="server" CssClass="pagingtext" Text=""></asp:Label> <asp:Label ID="Label5" runat="server" CssClass="pagingtext" Text="brugere"></asp:Label><br />
</td><br />
</tr><br />
<tr style="height: 4px;"><br />
<td colspan="3"><br />
</td><br />
</tr><br />
<tr><br />
<td style="width: 700px"></td><br />
<td id="lastcell" runat="server" style="text-align: right; border-top-style: none; border-top-width: 0px;"><br />
<asp:LinkButton ID="LinkButtonPreviousPage" ForeColor="#FFFFFF" runat="server" CssClass="pagingtext" CommandName="ChangePage" Text="Forrige"></asp:LinkButton> <br />
</td><br />
<td id="paginglinks" runat="server" style="text-align: right"></td><br />
<td id="lastcel2" runat="server" style="text-align: right;"><asp:LinkButton ID="LinkButtonNextPage" ForeColor="#FFFFFF" CssClass="pagingtext" runat="server" CommandName="ChangePage" Text="Næste"></asp:LinkButton> </td><br />
</tr><br />
</table> <br />
</PagerTemplate><br />
<HeaderStyle /><br />
<PagerStyle /><br />
<AlternatingRowStyle /> <br />
<RowStyle /><br />
</asp:GridView>
My Code in the skin file is:
<asp:GridView SkinID="GeneralView" runat="server"><br />
<br />
<PagerStyle BackColor="#2F5673" ForeColor="#FFFFFF" HorizontalAlign="Center" Height="15px" /><br />
<RowStyle BackColor="#FFFFFF" BorderStyle="None" /><br />
<AlternatingRowStyle BackColor="#F3F7FA" /><br />
<HeaderStyle BorderStyle="None" ForeColor="#FFFFFF" Font-Underline="true" BorderWidth="0px" BorderColor="#2F5673" Font-Bold="true" HorizontalAlign="Left" Height="25px" BackColor="#2F5673" /> <br />
<br />
</asp:GridView>
Kind regards,
simsen
|
|
|
|
|
Three days and 100 google searches later and I still can't find any resolution to this Gridview problem I'm having.
I've got a Gridview that is tied to a Sqldatasource. The delete command for the Sqldatasource is:
DeleteCommand="UPDATE tblIPAddress SET SubnetID = 0 WHERE SubnetID = @SubnetID;DELETE FROM tblSubnet WHERE SubnetID = @SubnetID"For reference, "SubnetID" in "tblIPAddress" is an integer field that allows nulls. It's not a primary key. The command executes smoothly (at least it appears to)- the correct record is deleted from "tblSubnet" and all appropriate records in "tblIPAddress" have their SubnetID value set to "0".
However... after the row is deleted from the Gridview, an exception is thrown:
"Specified argument was out of the range of valid values. Parameter name: value"
And a stack trace of:
[ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: value]
System.Web.UI.WebControls.GridView.set_SelectedIndex(Int32 value) +1500503
System.Web.UI.WebControls.GridView.HandleDeleteCallback(Int32 affectedRows, Exception ex) +354
System.Web.UI.DataSourceView.Delete(IDictionary keys, IDictionary oldValues, DataSourceViewOperationCallback callback) +123
System.Web.UI.WebControls.GridView.HandleDelete(GridViewRow row, Int32 rowIndex) +927
System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +1155
System.Web.UI.WebControls.GridView.RaisePostBackEvent(String eventArgument) +199
System.Web.UI.WebControls.GridView.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +174
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
From what little I can read of the stack trace, it would appear that the Gridview is having problems setting its SelectedIndex, but I've tried setting the SelectedIndex of the gridview to everything under the sun and nothing seems to make any difference. I've tried setting it to 0, -1, null (which doesn't work anyway), etc. I've tried setting it in the PageLoad even (using IsPostBack), the Gridview's row deleted event, row deleting, updated, updating, you name it.
The -one- thing I found on Google was someone mentioning that turning on paging in the gridview seemed to stop the problem. Oddly enough, it does. I enabled paging, set the page count to something really high so that more than one page is never created, and voila, the error goes away. That's a sloppy fix, though.
I've also found that adding GridView1.SelectedIndex = -1; AND GridView1.DataBind(); to the RowDeleted event of the Gridview causes the error NOT to be thrown if there's only one record in the Gridview and I delete it. If there's more than one record, the error gets thrown every time until there's only one record in the GridView.
Does anyone have any idea what could be going on here?
Thanks in advance.
|
|
|
|
|
AdamMcKee wrote: "SubnetID" in tblIPAddress" is an integer field
tblIPAddress is an integer. right?
AdamMcKee wrote: System.Web.UI.WebControls.GridView.set_SelectedIndex(Int32 value) +1500503
read above line.
the value 1500503 is out of range for integer.
define SubnetID as string or long.
bEst rEgard
pAthan
please don't forget to vote on the post that helped you.
|
|
|
|
|
Your workaround helped me so thanks for that. But I have the exact same problem and ran through the same troubleshooting steps with no luck. I was wonder if you ever found a fix?
|
|
|
|
|
I work on my graduation project , and I use Asp.net with SQL server to build my web-based system .
but I have a small problem , when I build the DB on the my computer with some of tables , and build the other tables on another computer , how I can combined these two parts of tables on one computer ??
please help me .
thaaaaanks,
|
|
|
|
|
You can open up connections to multiple databases in your application.
If you are using SQL Server you can link the servers together then create queries that will access data on both servers.
Of course, I am curious why you need data on two separate computers for a graduation project? Why is the data not on just one computer?
The best answer really depends on what you are trying to achieve.
|
|
|
|
|
Hi ,
Thanks for your replying, but me be I don’t explain my question in a good way ..
I want to combine these DB because my friend work with me to build this DB , but finally we want to combine these parts into one project on visual studio ..
Can I do it ??
|
|
|
|
|
Afternoon All,
I'm really starting to get my teeth into this .Net thing and, for the most part, am getting it pretty good. Every once in a while I run into something I cannot find through my readings so please bear with me.
I have a page that receives some data using the "string var = Request.Form["this"]" syntax. My problem is that on the same page, I have some hidden fields. I want to populate the hidden fields with the values I have received so that I can pass the fields to another page, which at this time is still .asp. I know I could use another method by reading the PreviousPage controls but I cannot get the hidden fields values to populate.
Additionally, in the Intellisense, I don't see the hidden fields in the list.
If I am doing this wrong any help or direction would be greatly appreciated.
F
|
|
|
|
|
There's a server control, asp:Hidden or something. If you use that, you will be able to set values on the server. The only thing is, the client id for a server control is not the id you enter in the IDE, so you need to write the ClientID value to a variable if you use it in javascript.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
They must have hidden that control from my list.
Thanks Christian for the road map.
I'm merrily along my way.
If so inclined, (could you expand on your point about the ClientID. Not quite sure I understand. I understand about the variable assignment but the "id is not the id" part that confused me.)
{}
else{
(Thanks again)}
|
|
|
|
|
On the server side, you may call it 'myHiddenId' ( I am not recommending that you do ). On the client side, it will be called something like 'form1_innercontrol_myHiddenId' ( that's just a bad example, not a real world one ). So, if you use document.getElementById to access the control from javascript, you would need to write a variable into your page in javascript so you have the right Id to work with, and you can get it from the ClientID property of the server control.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Got it.
Thanks for the clarity.
|
|
|
|
|
Glad to help
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi
how can emulate button click in a site in my ASP.NET code?
(button is in another site)
tanks for your reply.
|
|
|
|
|
You can't. Your ASP.NET code will always run on your server, why would you want to control another site there ? Your client side code needs to be javascript, and if you're trying to interact with another site, it means you have it open in another browser instance to the one that contains your javascript code.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
tank you Christian Graus for your reply.
really my company has a "sms data center" that several service on sms, such as dictionary, weather news, and ...
and my question is about this services. if we can emulate submit button means that we can have many services.
for example suppose an airport site that get airs program (flight program) that get proper data from user and get answer to user.
know if i can emulate submit click means that can have a new service for my "sms data center" solution.
now, can you help me?
|
|
|
|
|
Hi to all,
currently we're developping a tool in asp.net that will allow the user to open an image with the editor they want we're using the "open-with" dialog from windows with an javascript call on a clientclick. this works no problem
now after they open the file the asp.net page will be sitting and waiting for the image to be modified and saved (and not waiting for the editor to be closed, because some programs like photoshop take quite some time to open) so I've used the filesystemwatcher. I can catch the event with out a problem on the server side of the page but I can't seem to reload the page with the new image....
I know the call has been done asynchronocly and that this probable causing the problem. So I tried to use a clientscript with a history.go(0); and write it as a startup script but this doesnt seem to work either....
anyone got an idea? I would just need to reload the same page, with the same image when it is modified by saving it
Thanks in advance
its our widgets that make us men
|
|
|
|
|
Barbarus wrote: now after they open the file the asp.net page will be sitting and waiting for the image to be modified and saved (and not waiting for the editor to be closed, because some programs like photoshop take quite some time to open) so I've used the filesystemwatcher. I can catch the event with out a problem on the server side of the page but I can't seem to reload the page with the new image....
Simple answer is you can't (without using hacks/workarounds). The web browser is disconnected from the server so doesn't receive these events. One solution would be to have the page periodically reload the image using a refresh in javascript.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
|
sivaram praveen wrote: but javascript is not working
That's not a useful description of the problem. What does it do, and how does that differ from what you expected? Do you get any error message?
Why are you using a LinkButton? That will do a postback, so your javascript will never be called.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
Hello ppl,
I want to put a confirmation dialog box when a user clicks on the GridView Delete Command Button.
How can I do this?
Thanks
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
hi
after you insert a button in dataGridView , you can write follow code in onClientClick property :
OnClientClick="return confirm('are you ... ?')"
|
|
|
|
|
Thanks a lot man.
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
Just a quick question:
In ASP.Net are you encouraged to use controls such as the Panel for layout, rather than divs and whatever else you'd use in a plain olf HTML file?
Me: Can you see the "up" arrow?
User:Errr...ummm....no.
Me: Can you see an arrow that points upwards?
User: Oh yes, I see it now!
-Excerpt from a support call taken by me, 08/31/2007
|
|
|
|
|
martin_hughes wrote: In ASP.Net are you encouraged to use controls such as the Panel for layout, rather than divs and whatever else you'd use in a plain olf HTML file?
For me, I didn't have a need to use it, i am using tables as layout. Each control has it's own good and bad side.
|
|
|
|