.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Problem in accessing datakeys

Posted By:      Posted Date: August 29, 2010    Points: 0   Category :ASP.Net
I have kept an int element and char element as datakeys of gridview,first one being the int element. But when I write the following code, error comes up stating that "Index was out of range. Must be non-negative and less than the size of the collection.Parameter name: index" Why does the error come up? and how to remove it? protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { Char s =Convert.ToChar(GridView1.DataKeys[e.Row.RowIndex][1]); if (s == '0') e.Row.BackColor = System.Drawing.Color.Red; else e.Row.BackColor = System.Drawing.Color.SeaGreen; }  

View Complete Post

More Related Resource Links

Problem in accessing resource file dynamically.


Steps I have followed are
1.I have created myres.en-GB.resx file at C:.
2.then created locale specific myres.en-GB.resources using resgen at c: only,
resgen c:\myres.en-GB.resx
3.Linked the Resource File to Assembly using AL.exe which is giving me assembly at c: only.
Al /t:lib /embed:myres.en-GB.resources /out:ClassLibrary1.dll
4.I have created one web application using vs 2008 & then build it.
5.Then placed both resource file & dll in web applications Bin\en-GB folder.
6.Anf finally written code at page load like
 CultureInfo info = new CultureInfo("en-GB");
            Thread.CurrentThread.CurrentCulture = info;
            Assembly asd = Assembly.Load("ClassLibrary1");
            ResourceManager res = new ResourceManager("myres.en-GB", asd.GetSatelliteAssembly(info));
            string sdf = res.GetString("Lab1");

but after running application I m getting following error
MissingManifestResourceException", "Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "Cla

Problem accessing Sharepoint 2007 MySite


My users are having an issue accessing their mysites.  When they go to the main portal page or any other site and click the link at the top right of the page to go to their Mysite they are thrown into an endless authentication loop.  If they cancel out of the loop the URL in the address bar is for http://mossserver/_layouts/MySites.aspx

For a user to successfully get to their myself they need to enter the full url like http://mossserver/personal/username/default.aspx

Now, I know somewhat how this happened.  It resulted from me trying to delete a user's mysite and I apparently did it wrong but I'm not sure what I did.  It almost seems like I deleted a redirect page or something...

Looking for any ideas.



Having problem accessing multi-choice parameter in SQL Query in Report.

Hi, I have a report with a multi-choice input parameter. My report contains a dataset that uses CHARINDEX on this multichoice parameter. The dataset query is in text, not in stored procedure. When I run the report I get "the charindex requires 2-3 arguments the reason being that the SQL is run as follows (You can see the multi-choice list screws up the string: exec sp_executesql N'Select test.Region [Region], test.Location [Location], nvarchar3 [Year], nvarchar4 [StatisticType], nvarchar5 [StatisticType2], ntext2 [Detail], float1 [Amount]   from [WSS_Content].[dbo].[AllUserData] UD   inner join [WSS_Content].[dbo].[AllLists] AL on AL.tp_ID = UD.tp_ListId and AL.tp_Title=''Statistics''   left outer join   (       Select UD.tp_id [ID],nvarchar1 [Region],     nvarchar3 [Location]   from [WSS_Content].[dbo].[AllUserData] UD   inner join [WSS_Content].[dbo].[AllLists] AL on AL.tp_ID = UD.tp_ListID and AL.tp_Title=''Regions''   where UD.tp_ListId = AL.tp_ID   and UD.tp_ListId = AL.tp_ID   and UD.tp_DeleteTransactionId = 0x0   and tp_IsCurrentVersion = 1   ) test on test.id = UD.int1   where UD.tp_ListId = AL.tp_ID   and UD.tp_ListId = AL.tp_ID   and UD.tp_DeleteTransactionId = 0x0   and tp_IsCurrentVersion = 1  &n

Problem Accessing Mysites




I accedentialy deleted a handfull of users profiles. All of the users had created mysites. I just let FIM sync everything up and thought I would be alright, since I never deleted their AD account. When the users with recreated Profiles try to access their mysite they get the following error

Your personal site cannot be created because a site already exists with your username. Contact your site administrator for more information.

If I try to access any of the sites from the user profile service and click "manage personal site" it says the site has not been created.


The site is there users can successfuly access their personal and shared documents from the following links


http://xxx.xxx.com/persoanl/username/shared documents

but when trying to access

http://xxx.xxx.com/persoanl/username it gets redirected to the settings.aspx page on the mysite host site

Its as if the newley created profiles are missing a link to the already create mysites. I can successfuly get to _layoute/settings.aspx on the sites and have verified the permissions and actually reset them. Still no luck.


any ideas ?


Problem in accessing a PDF file in IIS 7.5


Hi Team,

I am trying to access a link in the ASP.NET page. This link should open a PDF file in browser. I have the handler configured to open the PDF file. Now the problem is that, since we have the space in the name of the file, i can see and HTTP 404 error coming up in the browser.

HTTP Error 400.0 - Bad Request

ASP.NET detected invalid characters in the URL.

Am i missing any setting specific to IIS / ASP.NET ?



Path Too Long Problem. Accessing filenames longer than 260 chars using unicode and kernel32.dll.

I found this article a few weeks ago that provided a way to access files and folders past the 260 char length:


I put the code from "Finding Files and Folders" in a dll and wrote an app in vb accessing these functions.  However, the code randomly breaks on a specific kernel32 function call. 

I noticed that if the search finds a file (not folder) longer than 12 to 14 characters then it breaks on occasion.  This is strange because I would think it would either never break or always break.

Here's the line where it breaks:

// find next

found = FindNextFile(findHandle, out findData);

Any ideas?


Problem accessing a WCF IIS Hosted Service from another WCF IIS Hosted Service on the same server.


I get the error message

The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from the server was 'Negotiate,NTLM'.

when I access a WCF service hosted in IIS(A) from another WCF service hosted in IIS(B).

I am able to access A from the same service B hosted in a wpf forms app, then I do not get an error and function is OK.

Any hints ?

Problem Accessing a Web Service Outside of Local Network


I've created a simple web service and tested it on my local machine and it worked perfectly. Another machine in the same local network tested using the web service and it worked fine as well. However, when I try to access the web service from outside of our local network, it returns a HTTP status 400: Bad Request error message. Any clues as to what might be causing this behavior?

It's my understanding that port 80 is for web services and that is not being blocked by a firewall or anything, so that is not the issue. Any help would be appreciated.

Problem accessing Report Server from client machine


We've deployed some reports from a server machine which can be accessed without any problems if you are logged onto the server itself by going to the URL of http://servername/ReportServer. However if we try and access the reports from a client machine (even if we use the same administrator Windows account) we get the Windows security window appear asking for a Username and Password to be entered in order to connect to the server. We've tried entering this but we then just get a blank screen after being re prompted a few times to enter the details.

Now I'm not sure whether this will be a Reporting Services or a Windows issue. Could it be a setting within IIS? It can't really be a user thing as the same user works on the server but not on the Client machine so it's more of a machine problem. It's as if there are some authentication settings somewhere that need to be set.

We are using SQL Server 2008 on Windows 7.


Thanks a lot


Problem in Accessing Server Controls Value or ID in JavaScript



I have a master page MasterPage.master


<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
    <asp:ContentPlaceHolder id="head" runat="server">
    <form id="form1" runat="server">
        <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">



And a Content Page Default.aspx


<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
  <script language="javascript" type="text/javascript" src="JScript.js"></script>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHol

Problem with accessing User defined types.



I have a User defined type with .net CLR and I am trying to use that in sql server 2005.

Following is the class which I have created for User Defined Type.

using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;

public class TxnRecObj : INullable,IBinarySerialize
  private int _InOutCode;
  private string _InOutData;
  private int _OraCode;
  private string _OraError;
  private string _ErrorData;

  private string _TRANS_CODE;
  private string _DA

Accessing the different controls inside a GridView control

how we can access a particular control which resides inside a GridView control. In this article I will show you how you can access different controls inside a GridView control. We will see how we can access a TextBox control, a DropDownList control and a ListBox control. If you are working with ASP.NET 1.X then you might want to check out my article Accessing Different Controls Inside a DataGrid.

Problem to group radio button across gridview rows

In general no one can easily group or make a single selection from radio button list inside gridview rows. There are a lot of way to make a single or unique selection from list. Here i want to share how i can address this problem in the most easiest way. Googling the problem most of the cases i saw the grouping in horizontal way. Thats why i tried to group the radio buttons in vertical manner. Let i have a requirement like below:

Regrading Sharpoint 2010 problem and solutions

We can write your question and problem on this blogger.you get ans.use.

This sharpoint 2010 problem solving threads

Hi friend,

you can use this thread to solving problem and solutions.

Accessing SharePoint 2010 Data with Server-Side APIs

Accessing SharePoint data in server-side solutions is one of the most common tasks that you will perform as a SharePoint developer. SharePoint 2010 provides powerful server-side APIs that enable you to retrieve, add, edit, and delete SharePoint data programmatically. SharePoint 2010 also includes the new LINQ to SharePoint technology that enables you to work with SharePoint data efficiently and easily.

Virtual Path Problem


 I get the following error on last line below (working on remote host): 'E:\web\sfcascom\ls_admin/uploads/images/001.JPG' is not a valid virtual path,

Note that the slashes go in different directions

I've tried a number of things but nothing seems to work. Thanks-


Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Drawing.Imaging
Imports System.Web.UI.WebControls

Imports System.Drawing.Imaging.ImageCodecInfo
Partial Class Protected_imageupload
    Inherits System.Web.UI.Page
    Private Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click
        ' Initialize variables
        Dim sSavePath As String
        Dim sThumbExtension As String
        Dim intThumbWidth As Integer
        Dim intThumbHeight As Integer
        Dim sFilename As String = ""
        ' Set constant values
        'sSavePath = "images/"
        sSavePath = Server.MapPath("~/") + "ls_admin/uploads/images/"

        sThumbExtension = "_thumb"
        intThumbWidth = 160
        intThumbHeight = 120

        ' If file field isn?t empty
        If FilUpload.PostedFile IsNot Nothing Then
            ' Check file size (mustn?t be 0)
            Dim myFile As Http
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend